Skip to content

Field reactivity (state and meta) docs #1207

Closed

Description

@LeCarbonator

This docs section should cover:

  • Use useStore to get field.state.meta
  • Why meta can get stale without them
  • Why field.state.value does not need it (or maybe it does! double check)

Can be a quick explanation, but the existing examples related to fields should reflect it.

Discussion for this issue was brought up in the celebration VOD

Activity

  1. added
    type: docsThis issue is related to documentation, or lack thereof.
    on Mar 4, 2025
  2. karan042 commented on Jul 8, 2025

    @karan042

    Will this be required when accessing field from form.Field (e.g. taken from here) or only from useFormContext?

    <form.Field
      name="age"
      validators={{
        onChange: ({ value }) =>
          value < 13 ? 'You must be 13 to make an account' : undefined,
      }}
    >
      {(field) => (
        <>
          <label htmlFor={field.name}>Age:</label>
          <input
            id={field.name}
            name={field.name}
            value={field.state.value}
            type="number"
            onChange={(e) => field.handleChange(e.target.valueAsNumber)}
          />
          {!field.state.meta.isValid && (
            <em role="alert">{field.state.meta.errors.join(', ')}</em>
          )}
        </>
      )}
    </form.Field>
  3. LeCarbonator commented on Jul 8, 2025

    @LeCarbonator
    ContributorAuthor

    Will this be required when accessing field from form.Field (e.g. taken from here) or only from useFormContext?

    <form.Field
    name="age"
    validators={{
    onChange: ({ value }) =>
    value < 13 ? 'You must be 13 to make an account' : undefined,
    }}

    {(field) => (
    <>
    Age:
    <input
    id={field.name}
    name={field.name}
    value={field.state.value}
    type="number"
    onChange={(e) => field.handleChange(e.target.valueAsNumber)}
    />
    {!field.state.meta.isValid && (
    {field.state.meta.errors.join(', ')}
    )}
    </>
    )}
    </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.
         return field.state.meta.isValid ? 'Yes' : 'No'
      }}
    </form.Field>
    
    <form.Field /* ... */>
       {field => {
          // you need to use useStore within YourTextField
         return <field.YourTextField  />
       }}
    </form.Field>
  4. added
    v1This issue has been created during v1 development.
    v2: needs investigationThis hasn't been confirmed or denied in v2 yet.
    v2This issue affects v2 as well.
    and removed
    v2: needs investigationThis hasn't been confirmed or denied in v2 yet.
    on Aug 9, 2026
  5. added a commit that references this issue on Oct 27, 2026
    12eea6d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: docsThis issue is related to documentation, or lack thereof.v1This issue has been created during v1 development.v2This issue affects v2 as well.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions