reactjs toggle state 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'
}));
this.setState(prevState => ({
iover: !prevState.iover
}));
this.setState(prevState => ({
iover: prevState.iover === 'hide' ? 'show' : 'hide'
}));