-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
React started giving warnings about componentWillMount recently. According to their suggestion there are 2 ways to implement a fix.
- 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-lifecyclesin your project source folder.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels