Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

componentWillReceiveProps needed.

See original GitHub issue

Hi, 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:open
  • Created 7 years ago
  • Reactions:12
  • Comments:7

github_iconTop GitHub Comments

ronzilcacommented, Jan 3, 2017

Works, but in my case the state command set like this: this.setState({isChecked: nextProps.isChecked})

DavitVoskcommented, Jun 21, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found