I have a TouchableOpacity that can be both pressed and unpressed.
Here is my useState variable:
const [isPressMonday, setIsPressMonday] = useState(false);
and here is my toggling function:
setIsPressMonday(!isPressMonday);
setDays(days => [...days, 'Monday'])
};
The thing is, when a user un-clicks the button, it should remove Monday from the array. This would be simple if I could just check if(!isPressMonday) and remove it from the array, but the default is false so that is almost always true