From 19d01ff41d0a482770a1ca5fa781fd12eb2b596a Mon Sep 17 00:00:00 2001 From: Marat Nepomnyashy Date: Sat, 30 Jun 2018 20:18:43 -0700 Subject: [PATCH] Modified state schema to add new field 'total_added' to keep track of the total number of times a new item has been added. This new field is intended to be used to give each item a unique lifetime ID to be used as the React key in the items listing, as well as to find the item to update its future checked status. --- webpack_in/entry.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webpack_in/entry.jsx b/webpack_in/entry.jsx index b8cc89d..75ecca8 100644 --- a/webpack_in/entry.jsx +++ b/webpack_in/entry.jsx @@ -83,7 +83,8 @@ class ListWidget extends React.Component { "Item 1", "Item 2", "Item 3" - ] + ], + total_added: 3 }; } @@ -112,7 +113,8 @@ class ListWidget extends React.Component { items: [ ...this.state.items, strItemNew - ] + ], + total_added: this.state.total_added + 1 }); }}/>