Skip to content

Commit 4003d6c

Browse files
authored
Merge pull request #47 from zoranmarjanovic/master
Enable to change state through the props
2 parents 7f8781a + 1524d1d commit 4003d6c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export default class CheckBox extends Component {
4848
leftTextStyle: {},
4949
rightTextStyle: {}
5050
}
51+
52+
componentWillReceiveProps(nextProps) {
53+
this.setState({
54+
isChecked: nextProps.isChecked
55+
})
56+
}
57+
5158
onClick() {
5259
this.setState({
5360
isChecked: !this.state.isChecked

0 commit comments

Comments
 (0)