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
Copy file name to clipboardExpand all lines: docs/tips/12-initial-ajax.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ next: false-in-jsx.html
9
9
10
10
Fetch data in `componentDidMount`. When the response arrives, store the data in state, triggering a render to update your UI.
11
11
12
-
When processing the response of an asynchronous request, be sure to check that the component is still mounted before updating its state by using `this.isMounted()`.
12
+
When fetching data asynchronously, use `componentWillUnmount` to cancel any outstanding requests before the component is unmounted.
13
13
14
14
This example fetches the desired Github user's latest gist:
15
15
@@ -23,15 +23,19 @@ var UserGist = React.createClass({
0 commit comments