ReactTraining / react-media

CSS media queries for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React v16.9 support

mikecousins opened this issue · comments

componentWillMount is deprecated with warnings now in 16.9.

Here is the warning that is emitted:
react-dom.development.js:12050 Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks 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: Media

Please have a look at the next release:

npm install react-media@next

1.10.0-alpha.1 works for me. Before, I was getting the following in the console:

react-dom.development.js:12050 Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks 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: Media

Now the message is gone. Thanks @edorivai.

@edorivai Hi,

So same as everyone else, why is this release an alpha any issues with the current lib?

Hi 👋,

Reason it's an behind the @next flag is because I wanted to make sure some people tested this out in the wild before publishing a minor version bump. Since it's a minor bump, depending on the setup people have they might auto upgrade to this version without realizing. This should be fine, it's a minor upgrade, so it should be backwards compatible, but I wanted to make sure before publishing.

I guess by now enough people have tested it (judging from the 👍's in this thread), I'll try to publish this on mainline soon.

v1.10.0 has been deployed as latest

npm install react-media should now install that version which should take care of any react deprecation warnings 🎉