@material-ui/core : 3.1.2
downshift : 3.2.10
formik : 1.3.2
react : 16.8.6
react-dom : 16.8.6
react-scripts : 3.0.1
_What you did:_
I created a dynamical form with formik and i use Downshift on custom field. I can add or remove component Downshift in form.
_What happened:_
When i add multi downshift and i remove one element , props change and my composant parent composant is re render. But Downshit show the bad value.
Example test :
Add 3 elements with 3 differents values. Remove the first element.
Formik has good values but Autocomplite re-render well, but Downshift show last value.
I do not understand why.
codesandbox : https://codesandbox.io/embed/dreamy-frost-z7vpk?fontsize=14
Sorry for my english, and if my post is not clear. It's my first time :)
what do you mean by Downshift show last value ? You are responsible for rendering values. do you get a bad value in the callback from Downshift? Which one?
it not related to downshift , you should use unique key not (index of array)
Thanks @jaabiri ! I will consider this closed.
Hello, sorry for my absence,
@jaabiri your solution seems to work even if I do not understand the difference between using i and perm in the key.
We have solved the problem using the props onStateChange in the real apps.
thx so much for your response.
Most helpful comment
it not related to downshift , you should use unique key not (index of array)
resolved : https://codesandbox.io/s/nostalgic-voice-08ie0