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

Replace UNSAFE_componentWillMount with constructor #62

Closed
voodoocreation opened this issue Dec 16, 2019 · 4 comments
Closed

Replace UNSAFE_componentWillMount with constructor #62

voodoocreation opened this issue Dec 16, 2019 · 4 comments

Comments

@voodoocreation
Copy link

This could be remedied by replacing UNSAFE_componentWillMount with a constructor definition, as that is the modern equivalent of using the now-deprecated componentWillMount. It will also avoid limiting your supported versions of react, as it's both backwards and forwards compatible.

UNSAFE_componentWillMount() {

@sabarasaba
Copy link

any chance we can get this merged in @gaearon ? this package is heavily used by react-helmet and im sure im not the only one bugged by all the warnings it generates 🐱

@andreyluiz
Copy link

andreyluiz commented Jan 6, 2020

@sabarasaba, there is https://github.com/iest/react-body-classname which is potentially impacted by this too.

@sophiebits
Copy link

Renaming to constructor isn't the correct fix as it won't be properly compatible with concurrent mode, where the render phase (including the constructor) might be called more than once.

@gaearon
Copy link
Owner

gaearon commented Feb 1, 2020

Like Sophie says, this isn't the right fix. #63 (comment)

@gaearon gaearon closed this as completed Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants