stackworx / formik-mui

Bindings for using Formik with Material-UI

Home Page:https://stackworx.github.io/formik-mui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change Select value will trigger Material-UI controlled/uncontrolled exception

jack-vo opened this issue · comments

Hi,
I am using the latest version of

  • material-ui 4.11.0
  • formik 2.2
  • formik-material-ui 3.0.1

I got the following Exception when I change the selection of the Select component
Material-UI: A component is changing the uncontrolled value state of Select to be controlled

Example code that I used:

<Field component={Select} type="text" name="tags">
    <MenuItem value="dogs">Dogs</MenuItem>
    <MenuItem value="cats">Cats</MenuItem>
    <MenuItem value="rats">Rats</MenuItem>
    <MenuItem value="snakes">Snakes</MenuItem>
</Field>

Thank you

Hi @jack-vo ,

This usually means the starting value was undefined. Can you create a code sandbox example?

<Formik
      initialValues={{
        tags: null,
      }}
...