I add a state like this:
setSelectedColors(prev => [...prev, color]);
but if I remove a state with filter is this already immuteable or had I forgot anything ?
setSelectedOptions(prev => prev.filter((el => {
if(el.color === currentColor && el.size === size) {
return false;
} else {
return true;
}
})));