diff --git a/src/App.tsx b/src/App.tsx index 58a1bec..0c81662 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,10 +19,10 @@ const FormValues = schema.fields.reduce((acc, currValue) => { export type TFormValues = typeof FormValues; function App() { - const [value, setValue] = useState(`${JSON.stringify(schema, null, 2)}`); - const onChange = useCallback((val, viewUpdate) => { - console.log("val:", val); - setValue(val); + const [value, setValue] = useState(schema); + const onChange = useCallback((val) => { + const tempSchema = SchemaDef.parse(JSON.parse(val)); + setValue(tempSchema); }, []); const { @@ -43,7 +43,7 @@ function App() {
diff --git a/src/components/fields/InputField.tsx b/src/components/fields/InputField.tsx index 022b6ea..e350ee6 100644 --- a/src/components/fields/InputField.tsx +++ b/src/components/fields/InputField.tsx @@ -17,7 +17,7 @@ const InputField = (props: InputFieldProps) => { console.log({ htmlFor, validation }); return ( <> -
+