I have recently upgraded formik from v1.1 to v1.3 and found that the meta prop in Field no longer working. Downgrading formik realizes that the issue starts to show up since v1.2 onwards. I assume this is a bug as it was a feature introduced in v1.1 and no change log that describes it has changed since.
By switching to v1.2
In another component the following FastField is used
<FastField name='firstName' label='First name *' component={StyledTextField} />
StyledTextField component
import React from 'react'
import TextField from '@material-ui/core/TextField';
import FormHelperText from '@material-ui/core/FormHelperText';
import FormControl from '@material-ui/core/FormControl';
const StyledTextField = props => {
const { field, form, label, meta } = props;
console.log('Styled ', field, form, meta) // meta is undefined in v1.2 and v1.3
return (
<FormControl error>
<TextField
{...field}
error={meta.touched && !!meta.error}
label={label}
/>
{ (meta.touched && meta.error) && <FormHelperText>{meta.error}</FormHelperText> }
</FormControl>
)
}
CodeSandbox Link:
https://codesandbox.io/s/lx9kpz2jl9
Ahh, when I rewrote FastField i forgot that we had added this. It's probably time to add it back (as a breaking change) in v2.
Fo reference, Field meta, never existed, just FastField (which is why I forgot).
I can update my long-standing PR - https://github.com/jaredpalmer/formik/pull/579 which should fix the issue.
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.
I think this is still important, especially since the doc mentions it:
https://jaredpalmer.com/formik/docs/api/fieldarray
_NOTE_: In Formik v0.12 / 1.0, a new
metaprop may be added toFieldandFieldArraythat will give you relevant metadata such aserror&touch, which will save you from having to use Formik or lodash's getIn or checking if the path is defined on your own.
Closing as stale
Most helpful comment
I think this is still important, especially since the doc mentions it:
https://jaredpalmer.com/formik/docs/api/fieldarray