Update highlighted lines in tutorial
Minor issue, but I found it distracting that the highlighted lines were not accurate. I *believe* this fixes them up.
Brian Cooke committed
Dec 9, 2013 at 15:16 UTC
42dee34146c7ef24cf6bf6962a39a1b468bcd03a
1 file changed
+7
-7
docs/docs/tutorial.md
+7
-7
@@ -320,7 +320,7 @@ That's it!
320
321
Let's replace the hard-coded data with some dynamic data from the server. We will remove the data prop and replace it with a URL to fetch:
322
323
-```javascript{2}
323
+```javascript{3}
324
// tutorial11.js
325
React.renderComponent(
326
<CommentBox url="comments.json" />,
@@ -373,7 +373,7 @@ We will use jQuery to help make an asynchronous request to the server.
373
374
Note: because this is becoming an AJAX application you'll need to develop your app using a web server rather than as a file sitting on your file system. The easiest way to do this is to run `python -m SimpleHTTPServer` in your application's directory.
375
376
-```javascript{4-11}
376
+```javascript{4-10}
377
// tutorial13.js
378
var CommentBox = React.createClass({
379
getInitialState: function() {
@@ -399,7 +399,7 @@ var CommentBox = React.createClass({
399
400
The key 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 trivial to add live updates. We will use simple polling here but you could easily use WebSockets or other technologies.
401
402
-```javascript{3,17-21,35}
402
+```javascript{3,14-17,30}
403
// tutorial14.js
404
var CommentBox = React.createClass({
405
loadCommentsFromServer: function() {
@@ -458,7 +458,7 @@ var CommentForm = React.createClass({
458
459
Let's make the form interactive. When the user submits the form, we should clear it, submit a request to the server, and refresh the list of comments. To start, let's listen for the form's submit event and clear it.
460
461
-```javascript{3-13,16,21}
461
+```javascript{3-13,16-17,21}
462
// tutorial16.js
463
var CommentForm = React.createClass({
464
handleSubmit: function() {
@@ -504,7 +504,7 @@ When a user submits a comment, we will need to refresh the list of comments to i
504
505
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:
506
507
-```javascript{13-15,32}
507
+```javascript{11-13,27}
508
// tutorial17.js
509
var CommentBox = React.createClass({
510
loadCommentsFromServer: function() {
@@ -570,7 +570,7 @@ var CommentForm = React.createClass({
570
571
Now that the callbacks are in place, all we have to do is submit to the server and refresh the list:
572
573
-```javascript{14-22}
573
+```javascript{12-19}
574
// tutorial19.js
575
var CommentBox = React.createClass({
576
loadCommentsFromServer: function() {
@@ -616,7 +616,7 @@ var CommentBox = React.createClass({
616
617
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.
618
619
-```javascript{14-16}
619
+```javascript{12-14}
620
// tutorial20.js
621
var CommentBox = React.createClass({
622
loadCommentsFromServer: function() {