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

React warning: componentWillMount has been renamed, and is not recommended for use #499

Closed
josenriagu opened this issue Dec 31, 2019 · 10 comments

Comments

@josenriagu
Copy link

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
Hey buddies, everything works fine, the head tags updates correctly except that the React warns that componentWillMount is obsolete.
See https://fb.me/react-unsafe-component-lifecycles for details.

react-warning

How did I know this caused the warning?
Well, when I remove/disconnect the from my App.js, the warning disappears.

Suggested fix according to the console message

  • Move code with side effects to componentDidMount, and set initial state in the constructor.
  • Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.

Please update the following components: SideEffect(NullComponent)

Which versions of React and react-helmet, and which browser / OS are affected by this issue?
Did this work in previous versions of React and/or react-helmet?

  • I never tested old versions of react-helmet.
  • I am using current version of React and Hooks in my Project.
  • Browser is Brave (Chromium-based)
  • OS is Windows 10 Pro
@GasimGasimzada
Copy link

This requires updating React Side Effects. They just need to update the package.

@josenriagu
Copy link
Author

@GasimGasimzada yes that's right. I hope it will be fixed in future updates

@MatthewJRoybal
Copy link

I'm a little confused because I'm reading that some are switching over to react-helmet-async mentioning that this project is no longer maintained....so, just checking, will this be updated or should we switch over? I'm using GatsbyJS and I'm getting this error as well.

@piehouserat
Copy link

I would also like some clarification on this, is this project still maintained or should we be switching to the async version?

@cwelch5
Copy link
Contributor

cwelch5 commented Jan 8, 2020

I've recently had the opportunity to devote some time back to this project. And I'm trying to as quickly as possible right this ship.

I understand if you'd like to play with react-helmet-async, but updates for this library will be coming. Then it'll be up to you all which one to stick with.

@josenriagu
Copy link
Author

Good job @cwelch5 . Keep it up buddy! 🎉

@TrejoCode
Copy link

@cwelch5 Please, thank you 🤑

@strommj
Copy link

strommj commented Jan 12, 2020

looks like react-side-effect is already working on this:
gaearon/react-side-effect#62

At the very least, the current version of react-side-effect suppresses the warning, so optionally update to v2.0.1 (latest) right now, but keep watch on that ticket to see when they update the issue on their side, then update to that version.

@cwelch5
Copy link
Contributor

cwelch5 commented Jan 27, 2020

Thanks for everyone's patience. We are actively working on 6.0.0 release. 6.0.0-beta.2 is available and will work with the latest React version.

@cwelch5 cwelch5 closed this as completed Jan 27, 2020
@SaudTauqeer
Copy link

I've recently had the opportunity to devote some time back to this project. And I'm trying to as quickly as possible right this ship.

I understand if you'd like to play with react-helmet-async, but updates for this library will be coming. Then it'll be up to you all which one to stick with.

I appreciate all the work you are putting in this!

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

No branches or pull requests

8 participants