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.

Move to React 16.3 and implement new lifecycle methods

See original GitHub issue

Since React 16.3 was out, componentWillReceiveProps is obsolete and has been renamed UNSAFE_componentWillReceiveProps. We should replace all its uses with recommended solutions.

Read more at React’s blog and documentation.

Here are some suggestions for each file. Note that they don’t all have the same difficulty !

  • src/components/app/ZipFileViewer.js (claimed by @qmya) Probably can be moved to componentDidUpdate
  • src/components/shared/Icon.js (claimed by @imabp) Can be replaced by componentDidUpdate
  • src/components/shared/IdleSearchField.js (claimed by @qmya) Probably replaced with a strategy Fully uncontrolled component with a key
  • src/components/shared/TreeView.js (claimed by @mstange) very possibly memoization
  • src/components/shared/chart/Canvas.js Strategy unclear. Maybe Fully uncontrolled component with a key.
  • src/components/shared/chart/Viewport.js (claimed by @imabp) Probably a mix. The parts that call setSizeNextFrame can easily be moved to componentDidUpdate. The part that compute an horizontalViewport could use a memoization strategy. The part that calls viewportNeedsUpdate may use getDerivedStateFromProps.
  • src/components/tooltip/Tooltip.js (claimed by @Segun-Ogundipe) Maybe moving it to componentDidUpdate works, but this needs careful testing. Possibly a strategy Fully uncontrolled component with a key is better.

Please comment on this issue to claim a component, and I will add your name to it. Please only work on one at a time, and send in 1 PR for each code path. This will make it easy for multiple people to work on this. We can give some more information where needed.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:37 (35 by maintainers)

github_iconTop GitHub Comments

2reactions
julienwcommented, Oct 13, 2020

@qmya @webobite I added both of you. Thanks for your help!

1reaction
mstangecommented, Aug 29, 2021

I just wrote a patch for TreeView.js and didn’t know about this issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

React v16.3.0: New lifecycles and context API
In React 16.3.0, we are adding a few new lifecycle methods to assist with that migration. We are also introducing new APIs for...
Read more >
Explain new lifecycle methods in React v16.3 - GeeksforGeeks
React 16.3 has introduced two new lifecycle methods: getDerivedStateFromProps(); getSnapshotBeforeUpdate(). Creating a React Application: Step 1 ...
Read more >
React 16.3 Lifecycle Methods - Medium
The new method getDerivedStateFromProps is a static function and is used instead of componentWillReceiveProps with React 16.3.
Read more >
Understanding React v16.4+ New Component Lifecycle ...
ReactJs v16.3 introduced significant changes in component lifecycle. There has been a few deprecations of methods as well as addition of new ......
Read more >
React 16.3: What's New? - Auth0
The current lifecycle methods componentWillMount , componentWillReceiveProps , and componentWillUpdate will be deprecated in a future ReactJS 16 ...
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