Skip to content

Commit 8184dda

Browse files
committed
update doc on create form control
1 parent 7c0a2c8 commit 8184dda

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/content/docs/createFormControl.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ This following table applied to `FormProvider`, `useFormContext` accepts no argu
1616
| ---------- | --------------------------- | ---------------------------------------------- |
1717
| `...props` | <TypeText>Object</TypeText> | `UseFormProps` |
1818

19+
<Admonition type="important" title="Notes">
20+
- This function is completely optional, you can consider to use this instead of `useFormContext` API.
21+
- You may find it useful if you would like to subscribe formsState by skipping react re-render.
22+
</Admonition>
23+
1924
**Examples:**
2025

2126
---
@@ -31,12 +36,13 @@ const { formControl, control } = createFormControl({
3136
}})
3237

3338
function App() {
34-
const { register } = useForm({
39+
const { register, handleSubmit } = useForm({
3540
formControl,
3641
})
3742

3843
return (
39-
<form>
44+
<form onSubmit={handleSubmit(data => console.log)}>
45+
<input {...register('name')} />
4046
<FormState />
4147
<Controller />
4248
</form>

0 commit comments

Comments
 (0)