IssueRaiser

Stop using `UNSAFE_componentWillMount`

**Do you want to request a *feature* or report a *bug*?** Bug **What is the current behavior?** get this warning in console when using Helmet: ``` Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor. Please update the following components: SideEffect(NullComponent) ``` **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React and react-helmet. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:** just include a `<Helmet>` anywhere in a rendered component in your app. 1) create typescript create-react-app ```sh npx create-react-app test --template typescript && \ cd test && \ npm i --save react-helmet && \ npm i --save-dev @types/react-helmet ``` 2) add the following in `App.tsx`: ```tsx <Helmet> <title>test</title> </Helmet> ``` 3) `npm start` **What is the expected behavior?** Don't use depreciated react APIs in libraries. Should not get this warning. **Which versions of React and react-helmet, and which browser / OS are affected by this issue? Did this wor

Posted by chadlavi on May 2, 2020, 5:15 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (SaaS)

Stop using `UNSAFE_componentWillMount`

chadlaviMay 2, 2020, 5:15 PM

**Do you want to request a *feature* or report a *bug*?** Bug **What is the current behavior?** get this warning in console when using Helmet: ``` Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor. Please update the following components: SideEffect(NullComponent) ``` **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React and react-helmet. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:** just include a `<Helmet>` anywhere in a rendered component in your app. 1) create typescript create-react-app ```sh npx create-react-app test --template typescript && \ cd test && \ npm i --save react-helmet && \ npm i --save-dev @types/react-helmet ``` 2) add the following in `App.tsx`: ```tsx <Helmet> <title>test</title> </Helmet> ``` 3) `npm start` **What is the expected behavior?** Don't use depreciated react APIs in libraries. Should not get this warning. **Which versions of React and react-helmet, and which browser / OS are affected by this issue? Did this wor

Comments (0)

No comments yet. Start the discussion.

Comment on this issue