React Checkbox not sending onChange

后端 未结 7 1401
夕颜
夕颜 2020-12-04 16:19

TLDR: Use defaultChecked instead of checked, working jsbin.

Trying to setup a simple checkbox that will cross out its label text when it is checked. For some reason

7条回答
  •  佛祖请我去吃肉
    2020-12-04 16:39

    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
    

提交回复
热议问题