mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make state immutable in tutorial (eek)
This commit is contained in:
committed by
Paul O’Shannessy
parent
d47d509637
commit
d3cee1ee2e
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user