Migrating from TanStack Form to Formisch is a rewrite of the form layer rather than a drop-in replacement. While component structures often remain similar, the mental model shifts from a state-container approach (defaultValues + per-field validators) to a schema-first approach (Valibot schema as the source of truth for types, validation, and structure).
Key architectural shifts include:
- Types: Inferred from the Valibot schema instead of
defaultValues. - Validation: Centralized in a schema; timing is controlled form-wide via
validate and revalidate options instead of per-field triggers. - Field Addressing: Uses path arrays (e.g.,
['todos', 0, 'label']) instead of interpolated strings. - Field Binding: Uses
field.props spreading instead of manual wiring of value, onChangeText, and onBlur. - Submission: Uses the
handleSubmit method to create a press handler. - State Access: Direct reading from the form store instead of using subscription selectors like
form.Subscribe. - Errors: Provided as plain string arrays in
field.errors instead of issue objects.
Both libraries can coexist in the same application, allowing for a gradual, form-by-form migration.