I\'d like to know how to toggle a boolean state of a react component. For instance:
I have boolean state check in the constructor of my component:
const
Try:
this.setState({check: !this.state.check.value})}/> Checkbox
Using check: !check.value means it is looking for the check object, which you haven't declared.
check: !check.value
check
You need to specify that you want the opposite value of this.state.check.
this.state.check