<FastField /> is meant for performance optimization. However, you really do not need to use it until you do. Only proceed if you are familiar with how React's
shouldComponentUpdate() works. You have been warned.
No. Seriously. Please review the following parts of the official React documentation before continuing
<FastField /> is an optimized version of
<Field /> meant to be used on large forms (~30+ fields) or when a field has very expensive validation requirements.
<FastField /> has the same exact API as
<Field>, but implements
shouldComponentUpdate() internally to block all additional re-renders unless there are direct updates to the
<FastField />'s relevant parts/slice of Formik state.
<FastField name="firstName" /> will only re-render when there are:
isSubmitting. This is determined by shallow comparison. Note: dotpaths are supported.
<FastField name="firstName" />
Other than for these aforementioned situations,
<FastField /> will not re-render when other parts of of Formik state change. However, all updates triggered by a
<FastField /> will trigger re-renders to other "vanilla"
<Field /> components.
<Field /> is "independent" of all other
<Field />'s in your form, then you can use
More specifically, if the
<Field /> does not change behavior or render anything that is based on updates to another
<Field /> or
<FastField />'s slice of Formik state AND it does not rely on other parts of top-level
<Formik /> state (e.g.
submitCount), then you can use
<FastField /> as a drop-in replacement to