Update tutorial.md
georgesisco committed
Apr 10, 2014 at 14:51 UTC
287db7017e1ba554f55399a165f6d07fe667e075
1 file changed
+4
-4
docs/docs/tutorial.md
+4
-4
@@ -411,7 +411,7 @@ var CommentBox = React.createClass({
411
412
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.
413
414
-```javascript{3,16-17,31}
414
+```javascript{3,19-20,34}
415
// tutorial14.js
416
var CommentBox = React.createClass({
417
loadCommentsFromServer: function() {
@@ -520,7 +520,7 @@ When a user submits a comment, we will need to refresh the list of comments to i
520
521
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:
522
523
-```javascript{12-14,28}
523
+```javascript{15-17,31}
524
// tutorial17.js
525
var CommentBox = React.createClass({
526
loadCommentsFromServer: function() {
@@ -590,7 +590,7 @@ var CommentForm = React.createClass({
590
591
Now that the callbacks are in place, all we have to do is submit to the server and refresh the list:
592
593
-```javascript{13-21}
593
+```javascript{16-27}
594
// tutorial19.js
595
var CommentBox = React.createClass({
596
loadCommentsFromServer: function() {
@@ -644,7 +644,7 @@ var CommentBox = React.createClass({
644
645
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.
646
647
-```javascript{13-15}
647
+```javascript{16-18}
648
// tutorial20.js
649
var CommentBox = React.createClass({
650
loadCommentsFromServer: function() {