From 969014c832aa76b844ee8b51f4c7a5be548bcddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Sat, 28 Nov 2015 11:30:35 -0800 Subject: [PATCH] Merge pull request #5556 from timuric/patch-1 Avoid mutating state in the example code (cherry picked from commit d54b151bc25ab6ea90d836b9565d60f4cd5224e5) --- docs/docs/10.1-animation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/10.1-animation.md b/docs/docs/10.1-animation.md index 74241251c6..dcea2d9ec0 100644 --- a/docs/docs/10.1-animation.md +++ b/docs/docs/10.1-animation.md @@ -29,7 +29,7 @@ var TodoList = React.createClass({ this.setState({items: newItems}); }, handleRemove: function(i) { - var newItems = this.state.items; + var newItems = this.state.items.slice(); newItems.splice(i, 1); this.setState({items: newItems}); },