Removing usage of deprecated React lifecycle hooks
See original GitHub issueDescription: Using React >= 16.3.x in StrictMode, deprecation warnings are thrown.
Warning: Unsafe lifecycle methods were found within a strict-mode tree:
in StrictMode (created by ReactSlickDemo)
in ReactSlickDemo
componentWillMount: Please update the following components to use componentDidMount instead: InnerSlider, Slider
componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: InnerSlider
Learn more about this warning here:
https://fb.me/react-strict-mode-warnings
Impact: Other than not corresponding to react best practices, and bloating the console with errors in dev mode, this is effectively means react-slick will break in version 17.x.
🌟 I’ve created a PR to remove usage of componentWillMount
(#1443)
BUT, removing componentWillReceiveProps
seems much more complicated…
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (4 by maintainers)
Top Results From Across the Web
Lifecycle deprecated/New Methods - React Training
This function will be called in each update life-cycle caused by changes to props (parent component re-rendering) and will be passed an object...
Read more >Understanding React v16.4+ New Component Lifecycle ...
In React 16.3 few lifecycle methods have been deprecated. For now, these methods are prefixed with UNSAFE_ and will be fully removed in...
Read more >Replacing Component Lifecycle Methods with React Hooks
Since other lifecycle methods will be deprecated in React 17, and, in the interim, require the use of the UNSAFE_ prefix, we will...
Read more >React.Component
Each component has several “lifecycle methods” that you can override to run code at particular times in the process. You can use this...
Read more >Using React's useEffect Hook with lifecycle methods
One of the main reasons that these lifecycle methods were deprecated is because when React implemented async rendering, the incorrect use of one ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released react-slick@0.25.0 with this fix
@maxizhukov use 27.12