Skip to content

Commit 6dbdeae

Browse files
committed
Merge pull request #246 from jgoliver/patch-1
Update tutorial.md
2 parents 08e6ba8 + 59765e2 commit 6dbdeae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/jekyll/getting-started/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ var CommentBox = React.createClass({
488488
`getInitialState()` executes exactly once during the lifecycle of the component and sets up the initial state of the component.
489489

490490
#### Updating state
491-
When the component is first created, we want to GET some JSON from the server and update the state to reflect the latest data. We'll use the standard XMLHttpRequest API to retrieve the data. If you need support for old browsers (mainly old Internet Explorer), you can use an AJAX library or a multipurpose library such as jQuery.
491+
When the component is first created, we want to GET some JSON from the server and update the state to reflect the latest data. We'll use the standard XMLHttpRequest API to retrieve the data. If you need support for old browsers (mainly old Internet Explorer), you can use an AJAX library or a multipurpose library such as jQuery. `componentWillMount()` executes immediately and only once before the rendering occurs. In the following example, `componentWillMount()` loads the data from our XMLHttpRequest and assigns it to the `data` variable. Finally, it sets the `data` variable in state, using `setState()`.
492492

493493
```javascript{6-12}
494494
var CommentBox = React.createClass({

0 commit comments

Comments
 (0)