You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`UNSAFE_componentWillMount`willnotgetcalledifthecomponentimplements [`static getDerivedStateFromProps`](getDerivedStateFromProps) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
790
+
-`UNSAFE_componentWillMount`willnotgetcalledifthecomponentimplements [`static getDerivedStateFromProps`](#static-getderivedstatefromprops) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
791
791
792
792
-Despiteitsnaming, `UNSAFE_componentWillMount`doesnotguaranteethatthecomponent*will*getmountedifyourappusesmodernReactfeatureslike [`Suspense`.](/reference/react/Suspense) Ifarenderattemptissuspended (for example, because the code for some child component has not loaded yet), Reactwillthrowthein-progresstreeawayandattempttoconstructthecomponentfromscratchduringthenextattempt. Thisiswhythismethodis"unsafe". Codethatreliesonmounting (like adding a subscription) shouldgointo [`componentDidMount`.](#componentdidmount)
793
793
@@ -823,7 +823,7 @@ If you define `UNSAFE_componentWillReceiveProps`, React will call it when the co
- `UNSAFE_componentWillReceiveProps` will not get called if the component implements [`static getDerivedStateFromProps`](getDerivedStateFromProps) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
826
+
- `UNSAFE_componentWillReceiveProps` will not get called if the component implements [`static getDerivedStateFromProps`](#static-getderivedstatefromprops) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
827
827
828
828
- Despite its naming, `UNSAFE_componentWillReceiveProps` does not guarantee that the component *will* receive those props if your app uses modern React features like [`Suspense`.](/reference/react/Suspense) If a render attempt is suspended (for example, because the code for some child component has not loaded yet), React will throw the in-progress tree away and attempt to construct the component from scratch during the next attempt. By the time of the next render attempt, the props might be different. This is why this method is "unsafe". Code that should run only for committed updates (like resetting a subscription) should go into [`componentDidUpdate`.](#componentdidupdate)
829
829
@@ -862,7 +862,7 @@ If you define `UNSAFE_componentWillUpdate`, React will call it before rendering
862
862
863
863
-`UNSAFE_componentWillUpdate` will not get called if [`shouldComponentUpdate`](#shouldcomponentupdate) is defined and returns `false`.
864
864
865
-
-`UNSAFE_componentWillUpdate` will not get called if the component implements [`static getDerivedStateFromProps`](getDerivedStateFromProps) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
865
+
-`UNSAFE_componentWillUpdate` will not get called if the component implements [`static getDerivedStateFromProps`](#static-getderivedstatefromprops) or [`getSnapshotBeforeUpdate`.](#getsnapshotbeforeupdate)
866
866
867
867
- It's not supported to call [`setState`](#setstate) (or any method that leads to `setState` being called, like dispatching a Redux action) during `componentWillUpdate`.
0 commit comments