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
Will this be required when accessing field from form.Field (e.g. taken from here) or only from useFormContext?
<form.Fieldname="age"validators={{onChange: ({value})=>value<13 ? 'You must be 13 to make an account' : undefined,}}>{(field)=>(<><labelhtmlFor={field.name}>Age:</label><inputid={field.name}name={field.name}value={field.state.value}type="number"onChange={(e)=>field.handleChange(e.target.valueAsNumber)}/>{!field.state.meta.isValid&&(<emrole="alert">{field.state.meta.errors.join(', ')}</em>)}</>)}</form.Field>
No. If you use the callback directly within form.Field, it will be rerendered when needed. This Issue refers to Form Composition, which means you extract it into its own component. That component will persist between rerenders, and therefore needs to manage the rerendering logic itself.
<form.Field/* ... */>{field=>{// this is up to date.returnfield.state.meta.isValid ? 'Yes' : 'No'}}</form.Field><form.Field/* ... */>{field=>{// you need to use useStore within YourTextFieldreturn<field.YourTextField/>}}</form.Field>
Activity
karan042 commentedon Jul 8, 2025
Will this be required when accessing field from form.Field (e.g. taken from here) or only from useFormContext?
LeCarbonator commentedon Jul 8, 2025
No. If you use the callback directly within
form.Field, it will be rerendered when needed. This Issue refers to Form Composition, which means you extract it into its own component. That component will persist between rerenders, and therefore needs to manage the rerendering logic itself.docs(react): document field state reactivity (TanStack#2445)