mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Make state immutable in tutorial (eek)
This commit is contained in:
1 parent
d47d509637
commit
d3cee1ee2e
1 file changed
+2
-2
@@ -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