Permalink
Browse files

Refactored <ListWidget> to render the items to display from its state…

… field 'items', which references an array of those items, and initialized that field to the same items as rendered previously.
  • Loading branch information...
maratbn committed Jun 30, 2018
1 parent a33e375 commit d835e40b4cc3746251a1bf83eb1ba7233857ef3e
Showing with 11 additions and 3 deletions.
  1. +11 −3 webpack_in/entry.jsx
@@ -77,16 +77,24 @@ class TextWidget extends React.Component {
class ListWidget extends React.Component {
constructor(props) {
super(props);
this.state = {
items: [
"Item 1",
"Item 2",
"Item 3"
]
};
}
render() {
return (
<div style={ objStyleCommon }>
<div style={ objStyleContent }>
<ul style={{ display: 'inline-block' }}>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
{ this.state.items.map((strItem, index) => (<li>
{ strItem }
</li>)) }
</ul>
</div>
<div>

0 comments on commit d835e40

Please sign in to comment.