react-formstate
There is a new version of this package: react-formstate-fp.
react-formstate-fp is designed to work with React Hooks, and makes several other substantive improvements to react-formstate.
react-formstate will continue to be maintained, but all new enhancements and improvements will be made to react-formstate-fp.
Thank you to all who supported react-formstate. React Hooks forced the rewrite.
An API to manage your form state...
react-formstate has two competing titles:
- DRY form validation in React.
- A comprehensive productivity API for React forms.
The thing is, you can't have one without the other.
The advantage of react-formstate is it's not a form controller. It doesn't drive your workflow. The only trade-off you make in using it is learning how to manage your form state through the API. Other than that you retain total control over your form component, even as you maximize productivity. The only thing it's not optimal for is extremely rapid prototyping from scratch.
react-formstate is actively used in real enterprise projects, so if you are evaluating this, you can check that box.
Contributing
For those who see its benefits, thank you for starring the package or for any other form of advocacy. Feedback, code contributions, and ideas for improvement are always welcome.
Setup
$ npm install react-formstate --save
Demo
Validated react-bootstrap components: react-formstate-demo
Walkthrough
Features and examples
- Basic example
- Show messages onChange, onBlur, or onSubmit
- Validation
- React-Bootstrap example
- Checkbox, CheckboxGroup, RadioGroup, Select
- Nonstandard input example: react-datepicker
Advanced features and examples
- Asynchronous validation
- Nested form components
- Form extension
- Arrays
- The onUpdate callback
- Redux integration
Documentation
- Advantages of react-formstate
- Criticisms of react-formstate
- v0.6.0 release notes
- v0.5.0 release notes
- API
- React forms
Peer dependencies
- React
- es5 (for example: Object.keys and Array.isArray)
- That's it!