question-mark
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.

Replace componentWillMount() and componentWillReceiveProps()

See original GitHub issue

The following warnings are displayed in the console when using a SideNav component:

Warning: componentWillMount has been renamed, and is not recommended for use. See
https://fb.me/react-async-component-lifecycle-hooks for details.

* 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: Uncontrolled(SideNav)
Warning: componentWillReceiveProps has been renamed, and is not
recommended for use. See https://fb.me/react-async-component-lifecycle-hooks
for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use
memoization techniques or move it to static getDerivedStateFromProps. Learn
more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps
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: Uncontrolled(SideNav)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
chetoncommented, Jan 13, 2020

Resolved in 0.5.0

0reactions
congdvcommented, Jan 11, 2020

Do you have any ideas to resolve this issue? I just think we just need update the uncontrollable dependency in package.json? I’m so new with js.

Read more comments on GitHub >

github_iconTop Results From Across the Web

componentWillMount is deprecated and will be removed in the ...
componentWillMount() is invoked just before mounting occurs. It is called before render(), therefore calling setState() synchronously in ...
Read more >
React: componentWillMount to be deprecated! - Northcoders
A significant change in React v16.3.0 is the deprecation of several methods. These are: componentWillMount. componentWillRecieveProps. componentWillUpdate.
Read more >
React.Component
Use shouldComponentUpdate() to let React know if a component's output is not affected by the current change in state or props. The default...
Read more >
React17, or how to get rid of “componentWillReceiveProps”?
componentWillMount ; componentWillReceiveProps; componentWillUpdate ... This method could be replaced by componentDidUpdate() according to React docs.
Read more >
Update React Component Lifecycle - Medium
Methods to get rid off from React 16.3. componentWillMount(); componentWillReceiveProps(); componentWillUpdate(). You need to remove these methods and move ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found