Browse Source

Make state immutable in tutorial (eek)

main
petehunt 12 years ago
parent
commit
ee83ad9f88
  1. 4
      docs/tutorial.md

4
docs/tutorial.md

@ -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…
Cancel
Save