Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] using componentWillRecieveProps when adding question #330

Closed
HemaSAli opened this issue Dec 8, 2018 · 2 comments
Closed

[Fix] using componentWillRecieveProps when adding question #330

HemaSAli opened this issue Dec 8, 2018 · 2 comments
Assignees

Comments

@HemaSAli
Copy link
Collaborator

HemaSAli commented Dec 8, 2018

Using componentWillRecieveProps when adding question

when adding question we send a new props to question Card component, so we need to run the function componentWillRecieveProps(props), to set the new props in the state
the new props which contain the new values of questions

@FarahZaqout
Copy link
Collaborator

componentWillReceiveProps will be deprecated in the next React version. This means it can lead to breaking changes or unexpected problems. Check out this article.

getDerivedStateFromProps Is the one to be safely used.

I need to read up more on them. This is a useful (but a bit confusing) github discussion.

@HemaSAli
Copy link
Collaborator Author

HemaSAli commented Dec 8, 2018

Thanks @FarahZaqout,
I read it, and I changed my code to use the this function

getDerivedStateFromProps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants