This repository was archived by the owner on Dec 15, 2022. It is now read-only.
fix warning at #2680#2681
Open
fix warning at #2680 #2681
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.
Description of the Change
componentWillRecievePropsis now deprecated, so this pr replaces it.https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops says:
"If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use
componentDidUpdatelifecycle instead."componentDidUpdateis called after updating, rather thancomponentWillRecieveProps.If this (or some other subtle change) happens to break atom, then I'll just use
UNSAFE_componentWillReceivePropsinstead.Warning text:
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
npx react-codemod rename-unsafe-lifecyclesin your project source folder.In this case, it's used for side effects (1st bullet point)
And this implies there will still be a warning when using
UNSAFE_componentWillReceivePropsin strict-mode, so tryingcomponentDidUpdatefirst.Screenshot or Gif
N/A
Applicable Issues
FixesPart ofFixes#2680