Manage react forms tersely and safely-typed with no magic.
$ yarn add @shopify/react-form-state
The default component exported by this library is
// Fields here refers to the inferred type of your initialValues object
Its only mandatory props are
initialValues prop is used to infer all the types for the rest of the component, and to generate handlers and field state objects. The
children prop expects a function of the current state of the form, which is represented by a
For detailed explanations of how to use
<FormState /> check out the guide.
The library also makes a number of validation factory functions available out of the box that should help with common use cases, as well as some tools to make building reusable custom validators easy.
For detailed explanations of the validation utilities, check out the validation docs.