Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FormProvider.md #751

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/api/react/FormProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ function Example() {

### FormProvider can be nested

This is useful if you need to have one form inside another due to layout constraint.
This is useful if you need to have one form inside another due to layout constraints.

```tsx
import { FormProvider, useForm } from '@conform-to/react';

function Field({ name, formId }) {
// useField will looks for the closest FormContext if no formId is provided
// useField will look for the closest FormContext if no formId is provided
const [meta] = useField(name, { formId });

return <input name={meta.name} form={meta.form} />;
Expand All @@ -74,7 +74,7 @@ function Child() {
<form id={form.id} />
<Field name={fields.title.name} />

{/* This will looks for the form context with the id 'parent' instead */}
{/* This will look for the form context with the id 'parent' instead */}
<Field name={fields.bar.name} formId="parent" />
</FormProvider>
);
Expand Down