trigger icon indicating copy to clipboard operation
trigger copied to clipboard

Updating the React version

Open dikujepsen opened this issue 7 years ago • 3 comments

Hi,

are there any plans for updating the react version from 16.0 to 16.4?

We are using React.StrictMode and we encounter the following warning in the console: """ index.js:1427 Warning: Unsafe lifecycle methods were found within a strict-mode tree: in div (created by MyReactComponent) in MyReactComponent (created by component) in div (created by component) in component (created by RouterContext) in RouterContext (created by Router) in Router

componentWillMount: Please update the following components to use componentDidMount instead: Trigger

componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: Trigger

Learn more about this warning here: https://fb.me/react-strict-mode-warnings """

I know it's probably a lot a work to go around the code base and update all the older and now unsafe life-cycle methods, but I am just wondering if you have any plans on an update.

dikujepsen avatar Oct 17 '18 14:10 dikujepsen

Please refactor these occurrences to support Strict Mode (and later asynchronous rendering).

ulrichb avatar Mar 16 '19 03:03 ulrichb

Are there any plans to update this alongside the upcoming changes for Ant design generally?

See https://fb.me/react-async-component-lifecycle-hooks for details

    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: Trigger

joshsmith avatar Aug 11 '19 15:08 joshsmith

It appears the latest version of rc-trigger (2.6.5) has been updated to use the new UNSAFE_componentWillMount and UNSAFE_componentWillReceiveProps functions. (at least, I don't see the warning when I updated to that version from 2.6.2)

(In my case, the issue was caused by my project dependency rc-tooltip, which had the sub-dependency rc-trigger. Since no new version of rc-tooltip was released, I just manually updated the rc-trigger subdependency using npm install --no-save rc-tooltip@latest)

Venryx avatar Sep 18 '19 09:09 Venryx