Reputation: 645
I made multiple select input with Material-UI
. By default state have an array of two objects. I set this state as select value, so it should show default objects as selected.
But problem is, that this not working, even when I try to select others items select updates this state but I can't to deselect default values.
I placed my code on CodeSandbox
Upvotes: 0
Views: 264
Reputation: 81
The default values you created are separate than the values in vesselsList. If you change your default state to this it works.
const [desiredVesselType, setDesiredVesselType] = useState([
vesselsList[3],
vesselsList[4]
]);
Upvotes: 1