Make state immutable in tutorial (eek)

This commit is contained in:
petehunt 2013-11-08 13:27:20 -08:00
parent b65e6a0453
commit f7103a8629
1 changed files with 2 additions and 2 deletions

View File

@ -629,8 +629,8 @@ var CommentBox = React.createClass({
},
handleCommentSubmit: function(comment) {
var comments = this.state.data;
comments.push(comment);
this.setState({data: comments});
var newComments = comments.concat([comment]);
this.setState({data: newComments});
$.ajax({
url: this.props.url,
type: 'POST',