toggle state value react code example
Example 1: react toggle state
this.setState(prevState => ({
iover: !prevState.iover
}));
Example 2: react toggle state
this.setState(prevState => ({
iover: prevState.iover === 'hide' ? 'show' : 'hide'
}));