Make state immutable in tutorial (eek)
This commit is contained in:
parent
b65e6a0453
commit
f7103a8629
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue