react setstate to opposite of current state code example
Example 1: toggle boolean state react
this.setState(prevState => ({
check: !prevState.check
}));
Example 2: react toggle state
this.setState(prevState => ({
iover: !prevState.iover
}));