react-icheck icon indicating copy to clipboard operation
react-icheck copied to clipboard

Documentation of onChange handling

Open cdxOo opened this issue 9 years ago • 2 comments

When passing onChange to the checkox component I expected to be able to read e.target.checked which doesnt work, since it triggers before rerendering the inner checkbox. I found that you explicitely pass the 'checked' argument to the given onChange function. This is good, but i needed to search through your code to find out about this, and i think that this is non-default behaviour. I would suggest adding this to the documentation.

cdxOo avatar Nov 03 '16 20:11 cdxOo

@cdxOo :+1:

luqin avatar Nov 04 '16 01:11 luqin

For anyone wondering how to do this:

handleCheck(e, checked) {
    console.log(e.target.value); //outputs the value of the checkbox
    console.log(checked); //outputs true or false
  }
<Checkbox onChange = {this.handleCheck} value="Apple" label="Apple"/>

ghost avatar Apr 17 '17 20:04 ghost