I have my toggle for checkbox in my application. It's not working.
I have tried using onChange function but it's not working.
Checkbox
<input
id="switchCheckboxInputAssert"
className="switch-checkbox-input"
type="checkbox"
checked={this.state.option.assert == 1 ? true : false}
value={this.state.option.assert}
onChange={this.assertChange}
disabled={!this.props.canBeSolution}
/>
onChange function
assertChange = () =>
this.setState({
option: { ...this.state.option, assert: !this.state.option.assert }
})
How can I toggle my checkbox properly?
this.props.canBeSolutiontrue / false.