Closed awefeng closed 2 years ago
this is a v17.0.2 example https://codesandbox.io/s/runtime-brook-z67gx3
That's a new behaviour inside StrictMode - https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors
Yes, this is a development-only change in Strict Mode described here. You can opt out of Strict Mode while upgrading if this breaks your code and then fix the issues later.
https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors
That's a new behaviour inside StrictMode - https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors
maybe I should take a good look at the update docs,thank you bro
Yes, this is a development-only change in Strict Mode described here. You can opt out of Strict Mode while upgrading if this breaks your code and then fix the issues later.
https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors
thank you bro
React version: v18.0.0
Steps To Reproduce
Link to code example: https://codesandbox.io/s/stoic-snowflake-pwih7o
The current behavior
the console print componentDidMount ->componentWillUnmount -> componentDidMount
The expected behavior
only run componentDidMount once