toggle state in react using a button 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'
}));