Skip to content

Commit 9e5a0be

Browse files
committed
Modified <ListWidget> rendering logic to use item ID rather than array index as the React key for the items listing, as an item's array index can change, while the ID will remain constant throughout its lifetime.
1 parent c8a1e79 commit 9e5a0be

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

webpack_in/entry.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ListWidget extends React.Component {
109109
<div style={ objStyleCommon }>
110110
<div style={ objStyleContent }>
111111
<ul style={{ display: 'inline-block', textAlign: 'left' }}>
112-
{ this.state.items.map((objItem, index) => (<li key={ index }>
112+
{ this.state.items.map((objItem, index) => (<li key={ objItem.id }>
113113
{ objItem.caption }
114114
</li>)) }
115115
</ul>

0 commit comments

Comments
 (0)