This repository was archived by the owner on Jun 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -45,24 +45,25 @@ export default function App() {
4545 const { control, handleSubmit } = useForm <FormValues >();
4646 const TypedController = useTypedController <FormValues >({ control });
4747
48- const onSubmit = handleSubmit ((data ) => alert ( JSON . stringify (data )) );
48+ const onSubmit = handleSubmit ((data ) => console . log (data );
4949
5050 return (
5151 <form onSubmit = { onSubmit } >
5252 { /* Uncontrolled Component */ }
53- <TypedController as = " input" name = " uncontrolled" defaultValue = " " />
5453 <TypedController
5554 as = " textarea"
5655 name = { [" nested" , " uncontrolled" , " test" ]}
5756 defaultValue = " "
5857 rules = { { required: true }}
5958 />
59+
6060 { /* Controlled Component */ }
6161 <TypedController
6262 name = " controlled"
6363 defaultValue = " "
6464 render = { (props ) => <TextField { ... props } />}
6565 />
66+
6667 <TypedController
6768 name = { [" nested" , " controlled" , 0 , " test" ]}
6869 defaultValue = { false }
@@ -71,6 +72,7 @@ export default function App() {
7172 }}
7273 render = { (props ) => <Checkbox { ... props } />}
7374 />
75+
7476 { /* Type Error */ }
7577 <TypedController
7678 as = " input"
@@ -87,6 +89,7 @@ export default function App() {
8789 name = " error"
8890 defaultValue = { true } // ❌: Type 'true' is not assignable to type 'string | undefined'.
8991 />
92+
9093 <input type = " submit" />
9194 </form >
9295 );
You can’t perform that action at this time.
0 commit comments