- Adds
onChange
andonInit
functions to formikFormik
component props to support form sync where needed - Adds
handleChange
andhandleInit
functions towithFormik
onChange
and handleChange
signatures are identical to onSubmit
and handleSubmit
onInit
and handleInit
signatures are identical to onSubmit
and handleSubmit
with first values
argument dropped.
onInit
and handleInit
functions return handlers to formik control functions, which could be used to update form state upon sync events.
Let's face it, forms are really verbose in React. To make matters worse, most form helpers do wayyyy too much magic and often have a significant performance cost associated with them. Formik is a small library that helps you with the 3 most annoying parts:
- Getting values in and out of form state
- Validation and error messages
- Handling form submission
By colocating all of the above in one place, Formik will keep things organized--making testing, refactoring, and reasoning about your forms a breeze.
You can play with Formik in your web browser with these live online playgrounds.
- CodeSandbox (ReactDOM) https://codesandbox.io/s/zKrK5YLDZ
- Expo Snack (React Native) https://snack.expo.io/Bk9pPK87X
- Basics
- Sync Validation
- Building your own input primitives
- Working with 3rd-party inputs #1: react-select
- Working with 3rd-party inputs #2: Draft.js
- Accessing React lifecycle functions
- React Native
- TypeScript
List of organizations and projects using Formik
- Jared Palmer @jaredpalmer
- Ian White @eonwhite
Formik is made with <3 thanks to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT License.