Question:
I am usingreact-select
within a MUI stepper together with Formik.My values for the react-select component are stored correctly within Formik’s state but when I go back a step and then forward again (mui stepper), my
react-select
component loses the values even though it’s still in Formik’s state.Just displays the placeholder value – “Fields”.
My code is as follows:
<ReactSelect />
component doesn’t re-display the values from Formik’s state (selectedFields
) when going back and forth through MUI’s stepper.Not sure what I am missing?
Answer:
It looks like you never set the value for the react-select. Try something like this:If you have better answer, please add a comment about this, thank you!