Permalink
Browse files

Nested the actual text caption of each list item in a sub-field 'capt…

…ion'. This is to allow for keeping track of other data for each item via other sub-fields.
  • Loading branch information...
maratbn committed Jul 1, 2018
1 parent 5bd1dc3 commit e1f5345347c59ae6f50bbe0a5ed60446df6960d9
Showing with 6 additions and 4 deletions.
  1. +6 −4 webpack_in/entry.jsx
@@ -78,11 +78,13 @@ class ListWidget extends React.Component {
constructor(props) {
super(props);
this._mutateStateToAddItem = (state, strItemNew) => ({
this._mutateStateToAddItem = (state, strItemCaption) => ({
...state,
items: [
...state.items,
strItemNew
{
caption: strItemCaption
}
],
total_added: state.total_added + 1
});
@@ -106,8 +108,8 @@ class ListWidget extends React.Component {
<div style={ objStyleCommon }>
<div style={ objStyleContent }>
<ul style={{ display: 'inline-block', textAlign: 'left' }}>
{ this.state.items.map((strItem, index) => (<li key={ index }>
{ strItem }
{ this.state.items.map((objItem, index) => (<li key={ index }>
{ objItem.caption }
</li>)) }
</ul>
</div>

0 comments on commit e1f5345

Please sign in to comment.