Console warning when adding reactn to class
See original GitHub issueHello, I notice some warnings when adding reactn to a class:
`componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
- Move data fetching code or side effects to componentDidUpdate.
- Rename componentWillUpdate to UNSAFE_componentWillUpdate 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-lifecycles
in your project source folder.
Please update the following components: ##ComponentName##`
How to reproduce:
Create a new project with create-react-app Create a component `import React, { Component } from ‘react’
export default class Compo extends Component { render() { return ( <div> I am a Component </div> ) } } ` and include it in App.js
Run -> No warnings change first line to `import React, { Component } from ‘reactn’ get warning:
`react-dom.development.js:12449 Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
- Move data fetching code or side effects to componentDidUpdate.
- Rename componentWillUpdate to UNSAFE_componentWillUpdate 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-lifecycles
in your project source folder.
Please update the following components: Compo`
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:20 (14 by maintainers)
Top GitHub Comments
Hi @CharlesStover, I have attempted the pseudocode you mentioned and it works! Made a PR that satisfies all tests, hope that helps! Umberto Ghio
@jasonbodily hi, seems that the current release on npm does not include yet this fix.
You may temporarily clone from this master or temporarily use version “SIAPCN/reactnUnsafe” in your package.json instead of 2.2.5, it contains the workaround that suppressed the warnings