Update tutorial.md

This commit is contained in:
georgesisco 2014-04-10 14:51:10 -04:00
parent af7ea7c999
commit 287db7017e
1 changed files with 4 additions and 4 deletions

View File

@ -411,7 +411,7 @@ var CommentBox = React.createClass({
Here, `componentWillMount` is a method called automatically by React before a component is rendered. The key to dynamic updates is the call to `this.setState()`. We replace the old array of comments with the new one from the server and the UI automatically updates itself. Because of this reactivity, it is only a minor change to add live updates. We will use simple polling here but you could easily use WebSockets or other technologies.
```javascript{3,16-17,31}
```javascript{3,19-20,34}
// tutorial14.js
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
@ -520,7 +520,7 @@ When a user submits a comment, we will need to refresh the list of comments to i
We need to pass data from the child component to its parent. We do this by passing a `callback` in props from parent to child:
```javascript{12-14,28}
```javascript{15-17,31}
// tutorial17.js
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
@ -590,7 +590,7 @@ var CommentForm = React.createClass({
Now that the callbacks are in place, all we have to do is submit to the server and refresh the list:
```javascript{13-21}
```javascript{16-27}
// tutorial19.js
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
@ -644,7 +644,7 @@ var CommentBox = React.createClass({
Our application is now feature complete but it feels slow to have to wait for the request to complete before your comment appears in the list. We can optimistically add this comment to the list to make the app feel faster.
```javascript{13-15}
```javascript{16-18}
// tutorial20.js
var CommentBox = React.createClass({
loadCommentsFromServer: function() {