An API to build, query, update, and bind formstate in React.
With react-formstate-fp, and your choice of input components, you can assemble forms DRYly in React.
By focusing on your form's data, and keeping you in control of your form's behavior, react-formstate-fp eliminates the busy work involved with React forms, without limiting you or getting in your way.
npm install --save react-formstate-fp
All examples demonstrated here.
- Basic example
- Typescript example
- How is this better than raw React?
- Why the departure from react-formstate?
- Initialization
- Binding inputs to formstate
- Synchronous validation
- Asynchronous validation
- Submitting
- Change and blur handlers
- Nested forms
- Arrays, addModelKey, deleteModelKey
- Quirks and edge cases
- useFormstate and bindToSetStateComponent
- API index
- A peer dependency on React >= 16.8 (React hooks).
- @babel/runtime might be pulled in depending on how you build your project.
Basically no dependencies other than React.
- Assumes an es5 environment (for example: Object.keys and Array.isArray).
- Assumes es6 promises. (This is the only polyfill requirement beyond es5.)
- Works with Typescript.
Thanks for your interest!