From 5725676aa7a64799129cfc4e7d1b49482e555565 Mon Sep 17 00:00:00 2001 From: PNikray Date: Thu, 26 Feb 2015 19:37:05 +0100 Subject: [PATCH 1/2] Added the key attribute into the todo example This is to solve the warning (that the key should be set) that was being raised when adding a new item. --- _js/examples/todo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_js/examples/todo.js b/_js/examples/todo.js index 2ecea761..de28d9ca 100644 --- a/_js/examples/todo.js +++ b/_js/examples/todo.js @@ -1,8 +1,8 @@ var TODO_COMPONENT = ` var TodoList = React.createClass({ render: function() { - var createItem = function(itemText) { - return
  • {itemText}
  • ; + var createItem = function(itemText, index) { + return
  • {itemText}
  • ; }; return ; } From cfe4d1335ec7ad27d47787f4d37e7d2d963d7ed3 Mon Sep 17 00:00:00 2001 From: PNikray Date: Mon, 2 Mar 2015 19:49:42 +0100 Subject: [PATCH 2/2] Modified the todo example. Instead of only using the index to supress the warning it now uses the text + index to also ensure object iteration order. --- _js/examples/todo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_js/examples/todo.js b/_js/examples/todo.js index de28d9ca..2f80ed48 100644 --- a/_js/examples/todo.js +++ b/_js/examples/todo.js @@ -2,7 +2,7 @@ var TODO_COMPONENT = ` var TodoList = React.createClass({ render: function() { var createItem = function(itemText, index) { - return
  • {itemText}
  • ; + return
  • {itemText}
  • ; }; return ; }