From ee83ad9f88b7adc883c6e7ee581a311824f3af18 Mon Sep 17 00:00:00 2001 From: petehunt <floydophone@gmail.com> Date: Fri, 8 Nov 2013 13:27:20 -0800 Subject: [PATCH] Make state immutable in tutorial (eek) --- docs/tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 089af109..2cd8b19e 100644 --- a/docs/tutorial.md +++ b/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',