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
* useComponentDidMount() is invoked immediately after a component is mounted.
8
+
* useDidMount() is invoked immediately after a component is mounted.
9
9
this is a good place to instantiate the network request.
10
10
11
11
This method is a good place to set up any subscriptions.
12
12
If you do that, don’t forget to unsubscribe in componentWillUnmount().
13
13
14
-
You may call setState() immediately in useComponentDidMount().
14
+
You may call setState() immediately in useDidMount().
15
15
It will trigger an extra rendering.
16
16
* @param {Function} callback
17
17
*/
18
-
constuseComponentDidMount=(callback)=>{
18
+
constuseDidMount=(callback)=>{
19
19
useEffect(()=>{
20
20
callback()
21
21
// eslint-disable-next-line
22
22
},[])
23
23
}
24
24
25
25
/**
26
-
* useComponentDidUpdate() is invoked immediately after updating occurs.
26
+
* useDidUpdate() is invoked immediately after updating occurs.
27
27
This method is not called for the initial render.
28
28
29
29
Use this as an opportunity to operate on the DOM when the component has been updated.
30
30
This is also a good place to do network requests as long as you compare the current props to previous props (e.g. a network request may not be necessary if the props have not changed).
0 commit comments