React Checkbox not sending onChange
To get the checked state of your checkbox the path would be:
this.refs.complete.state.checked
The alternative is to get it from the event passed into the handleChange
method:
event.target.checked
It's better not to use refs in such cases. Use:
<input
type="checkbox"
checked={this.state.active}
onClick={this.handleClick}
/>
There are some options:
checked
vs defaultChecked
The former would respond to both state changes and clicks. The latter would ignore state changes.
onClick
vs onChange
The former would always trigger on clicks.
The latter would not trigger on clicks if checked
attribute is present on input
element.