componentWillReceiveProps needed.
See original GitHub issueHi, i try to use your component, but you forget add componentWillReceiveProps method. Because when i set checked state from my form, it still going with own current state. For checked props you can add;
componentWillReceiveProps(nextProps) {
this.setState({isChecked: nextProps.checked})
}
Happy Coding.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:7
Top Results From Across the Web
React.Component
To define a React component class, you need to extend React.Component : ... This lifecycle was previously named componentWillReceiveProps .
Read more >React17, or how to get rid of “componentWillReceiveProps”?
Lets say I need to make some comparison between two arrays, inside getDerivedStateFromProps . I can not access component internal functions, using this....
Read more >ReactJS – componentWillReceiveProps() Method
This method is used during the updating phase of the React lifecycle. This function is generally called if the props passed to the...
Read more >Updating and componentWillReceiveProps() · React In-depth
We can get our current props by calling this.props and the new value is the nextProps argument passed to the method. Updating State....
Read more >Replacing 'componentWillReceiveProps' with ... - Medium
Unlike componentWillReceiveProps you cannot set state inside this method, ... state otherwise null will be returned indicating state update not required.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Works, but in my case the state command set like this:
this.setState({isChecked: nextProps.isChecked})
Guys you can use https://github.com/DavitVosk/react-native-check-box.git fork