v1.0.0-alpha.1
Pre-release
Pre-release
·
1422 commits
to main
since this release
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. whenonBlur
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
andhandleBlur
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>