Setting value with initial values does not update selected tags when adding or removing items. #4617
-
Hi, I'm having a hard time understanding how to set initial values. I've read a couple of issues and they all pointed to the same solution, using I've created this code sandbox: https://codesandbox.io/s/snowy-https-93dd1?file=/src/SearchAddressProvider.tsx And if you look in file I'd be very grateful if someone who faced this issue and was able to fix it could either update the code sandbox with a working example or tell me how I could fix this issue. Thank you very much for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @alveshelio, I hope you don't mind me converting your issue to a discussion. It seemed more fitting as your query does not include an issue in the library but instead a question regarding implementation. Your CodeSandbox example seems to be unavailable, but I had a look before and can probably offer a solution. You used a prop called As I could see (and remember) you used your I recommend using the |
Beta Was this translation helpful? Give feedback.
Hello @alveshelio,
I hope you don't mind me converting your issue to a discussion. It seemed more fitting as your query does not include an issue in the library but instead a question regarding implementation.
Your CodeSandbox example seems to be unavailable, but I had a look before and can probably offer a solution.
You used a prop called
initialSelectedAddresses
in yourMultiSelectAddress
component. This prop should contain your inital value of theSelect
component.In the
MultiSelectAddress
component you also have a state calledselectedAddresses
. This seems to be your state to which you want the initial values to be applied.As I could see (and remember) you used your
initialSelectedA…