react-image-annotation icon indicating copy to clipboard operation
react-image-annotation copied to clipboard

Warning: componentWillMount, componentWillReceiveProps (React 16.x)

Open drichar opened this issue 5 years ago • 1 comments

I'm on React 16.12, and seeing the following warning

Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
      
      * 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-lifecycles` in your project source folder.
      
      Please update the following components: styled.div, styled.img

(also a similar warning for componentWillReceiveProps)

It's originating from styled-components, which still uses these lifecycle methods in v3: https://github.com/Secretmapper/react-image-annotation/blob/master/package.json#L24

Upgrading to v4/v5 should fix this for anyone using react-image-annotation in React 16.9+ projects. Eventually, in React 17 it simply will not work.

drichar avatar Feb 04 '20 08:02 drichar

+1 also running into this problem. Are you open to receiving a PR to fix this?

joelpoloney avatar Oct 06 '20 00:10 joelpoloney