-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
React has deprecated its use of a selection of lifecycle methods it has deemed to be unsafe.
The componentWillMount, componentWillReceiveProps and componentWillUpdate lifecycle methods have the potential to cause headaches and We should use the newer, more stable lifecycle methods of getDerivedStateFromProps and getSnapshotBeforeUpdate instead.
We could shuffle onto using UNSAFE_componentWillMount etc but that doesn't fix the root problem.
The good news is ESLint now warns about our usage of these methods so we no longer have to think about this when doing PR reviews, however there are still a few places in existing code where they are used. Any existing use of these functions should be removed
Search the codebase for react/no-deprecated and refactor the usage of the componentWillMount, componentWillReceiveProps and componentWillUpdate to use the new lifecycle functions.
As of 2018-10-04, searching the codebase for react/no-deprecated shows the following Components are affected:
- AppProvider
- Collapsible (WIP: @dleroux )
- FileUpload (pr [FileUpload] Remove outdated lifecycle methods and fix issue with stale state #1233)
- EventListener
- OptionList
- PositionedOverlay
- ResourceList
- Tabs
- TextField
- ThemeProvider