I have multiple checkbox in my React Class B.js
:
<input type="checkbox" inline={true} checked={this.props.checkBoxDefaultStatus} onChange={this.handleCheckBoxClick} />
Now the prop checkBoxDefaultStatus
is passed from parent class A.js
.
A.js
this.state = { checkBoxDefaultStatus: false}handleMultiSelect() { this.setState({ checkBoxDefaultStatus: true })}render() {<B checkBoxDefaultStatus={this.state.checkBoxDefaultStatus} />}
EDIT: Now All my child checkboxes are getting checked when I click on parent checkbox, but the issue is that my child checked boxes checked status does not change when I click on them as they are already set by parent prop. I need some way to maintain this also.
This is the behaviour I want https://stackoverflow.com/a/35218069/6574017