You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This mechanism exists solely to bridge integration constraints and should be avoided whenever `withForm` is possible.
279
+
> Context will not warn you when the types do not align. You risk runtime errors with this implementation.
280
+
281
+
Usage:
282
+
283
+
```tsx
284
+
// sharedOpts.ts
285
+
const formOpts =formOptions({
286
+
/* ... */
287
+
})
288
+
289
+
function ParentComponent() {
290
+
const form =useAppForm({ ...formOptions/* ... */ })
291
+
292
+
return (
293
+
<form.AppForm>
294
+
<ChildComponent/>
295
+
</form.AppForm>
296
+
)
297
+
}
298
+
299
+
function ChildComponent() {
300
+
const form =useTypedAppFormContext({ ...formOptions })
301
+
302
+
// You now have access to form components, field components and fields
303
+
}
304
+
```
305
+
251
306
## Reusing groups of fields in multiple forms
252
307
253
308
Sometimes, a pair of fields are so closely related that it makes sense to group and reuse them — like the password example listed in the [linked fields guide](./linked-fields.md). Instead of repeating this logic across multiple forms, you can utilize the `withFieldGroup` higher-order component.
0 commit comments