Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
bluebill1049 committed Feb 1, 2025
1 parent 6951870 commit 9b1f5ea
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/ApiGallery.module.css
Original file line number Diff line number Diff line change
@@ -100,5 +100,5 @@
p.beta {
margin-bottom: -1rem;
font-size: 0.7rem;
color: var(--color-light-grey)
color: var(--color-light-grey);
}
3 changes: 2 additions & 1 deletion src/components/ApiGallery.tsx
Original file line number Diff line number Diff line change
@@ -167,7 +167,8 @@ export default function ApiGallery() {
</h3>
<p className={styles.beta}>BETA @v7.55.0-next.3</p>
<p>
Create form control object and subscribe form state outside of React component, access methods without context.
Create form control object and subscribe form state outside of
React component, access methods without context.
</p>
<Link
href="/docs/createFormControl"
20 changes: 10 additions & 10 deletions src/content/docs/createFormControl.mdx
Original file line number Diff line number Diff line change
@@ -14,16 +14,15 @@ This function create the entire form state subscription and allow you to subscri
| ---------- | --------------------------- | -------------- |
| `...props` | <TypeText>Object</TypeText> | `UseFormProps` |


### Returns

---

| Name | Type | Description |
| ---------- | --------------------------- | -------------- |
| `formControl` | <TypeText>Object</TypeText> | control object for `useForm` hook |
| `control` | <TypeText>Object</TypeText> | control object for `useController`, `useFormState`, `useWatch` |
| `...returns` | <TypeText>Functions</TypeText> | `useForm` return methods |
| Name | Type | Description |
| ------------- | ------------------------------ | -------------------------------------------------------------- |
| `formControl` | <TypeText>Object</TypeText> | control object for `useForm` hook |
| `control` | <TypeText>Object</TypeText> | control object for `useController`, `useFormState`, `useWatch` |
| `...returns` | <TypeText>Functions</TypeText> | `useForm` return methods |

<Admonition type="important" title="Notes">
- This function is published at **v7.55.0-next.3** - This function is
@@ -37,7 +36,8 @@ This function create the entire form state subscription and allow you to subscri
```tsx
const props = createFormControl()

<FormProvider {...props} /> // ❌ You don't need provider
{" "}
<FormProvider {...props} /> // ❌ You don't need provider

<input {...props.register('name')} /> // ✅ Direct use method from createFormControl
```
@@ -90,15 +90,15 @@ const { formControl, register } = createFormControl(props)
formControl.subscribe({
formState: {
isDirty: true,
values: true
values: true,
},
callback: (formState) => {
if (formState.isDirty) {
// do something here
}

if (formState.values.test.length > 3) {
// do something here
// do something here
}
},
})
@@ -110,7 +110,7 @@ function App() {

return (
<form>
<input {...register('test')} />
<input {...register("test")} />
</form>
)
}

0 comments on commit 9b1f5ea

Please sign in to comment.