Make state immutable in tutorial (eek)
petehunt committed
Nov 8, 2013 at 13:27 UTC
f7103a86299fc13b97a7e3c1699c2e55c0a38f96
1 file changed
+2
-2
docs/docs/tutorial.md
+2
-2
@@ -629,8 +629,8 @@ var CommentBox = React.createClass({
629
},
630
handleCommentSubmit: function(comment) {
631
var comments = this.state.data;
632
- comments.push(comment);
633
- this.setState({data: comments});
632
+ var newComments = comments.concat([comment]);
633
+ this.setState({data: newComments});
634
$.ajax({
635
url: this.props.url,
636
type: 'POST',