docs(react): add Getting and Setting Form Values guide#2077
Open
mixelburg wants to merge 1 commit intoTanStack:mainfrom
Open
docs(react): add Getting and Setting Form Values guide#2077mixelburg wants to merge 1 commit intoTanStack:mainfrom
mixelburg wants to merge 1 commit intoTanStack:mainfrom
Conversation
Adds a new guide page that covers: - Initializing forms with static and async/API-fetched values (with and without TanStack Query) - Reading field values reactively (useStore, form.Subscribe) and imperatively (getFieldValue, form.state.values) - Setting field values programmatically (setFieldValue, field.setValue, form.reset) - Validation behaviour when setting values programmatically, and how to suppress or trigger it manually - Marking fields as touched alongside programmatic updates - Brief overview of the listeners API for side-effect-driven value changes, with links to the Reactivity and Listeners guides Closes TanStack#478
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new guide page (React) covering the frequently-asked question of how to read and write form values in TanStack Form.
Closes #478
What's included
The guide walks through all the scenarios raised in the issue:
defaultValues(static & shared viaformOptions)fetch+ state pattern; TanStack Query (links to existing async-initial-values guide)useStore,form.Subscribe(links to Reactivity guide)form.getFieldValue(),form.state.valuesform.setFieldValue(),field.setValue()/field.handleChange()form.reset(newValues){ dontValidate: true }; manual trigger viaform.validateField()field.setMeta()alongside the value updateThe guide is also added to the navigation in
docs/config.jsonright after "Basic Concepts".Checklist
docs/config.jsonunder the React Guides section