npm formik 1.0.0-alpha.1

latest releases: 2.4.6, 2.4.5, 2.4.4...
6 years ago

Alpha Release

New Stuff

  • <FastField>: This is an optimized version of <Field> that only re-renders when necessary. More documentation is necessary, but essentially, <FastField> keeps state locally if possible and then updates the parent <Formik> state only when the <FastField> is blurred (i.e. when onBlur is fired). The key insight is that 99% of time, only one field is changing at a time in your form. However, if you are doing complex validation wherein one input's value can cause an error in another input, <FastField> will act like <Field> and just re-render on each update. Depending on the feedback, <FastField> may replace <Field> entirely in the future. Please be gentle.
  • Curried handleChange and handleBlur: You can now optionally pass a dotpath / name to both handleChange and handleBlur and they will each return an optimized handler. This works like Preact's linkState mixin. So now you can do
    <TextInput onChangeText={handleChange('firstName')} value={values.firstName}/> in React Native and also just <input onChange={handleChange('firstName')} value={values.firstName}/> in React DOM.
  • Curried array helpers: Each array helper provided via <FieldArray> (e.g. push('something')) now also has a curried version of itself (e.g. handlePush('something')). You can use these to avoid an arrow function inside of render: <button onClick={arrayHelpers.handlePush('')}>Add</button>

Don't miss a new formik release

NewReleases is sending notifications on new releases.