Permalink
Browse files

Modified <ListWidget> 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.
  • Loading branch information...
maratbn committed Jul 1, 2018
1 parent bebcb07 commit 19d01ff41d0a482770a1ca5fa781fd12eb2b596a
Showing with 4 additions and 2 deletions.
  1. +4 −2 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
});
}}/>
<ButtonWidget caption="Edit item..." />

0 comments on commit 19d01ff

Please sign in to comment.