Skip to content

Commit d835e40

Browse files
committed
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.
1 parent a33e375 commit d835e40

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

webpack_in/entry.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,24 @@ class TextWidget extends React.Component {
7777
class ListWidget extends React.Component {
7878
constructor(props) {
7979
super(props);
80+
81+
this.state = {
82+
items: [
83+
"Item 1",
84+
"Item 2",
85+
"Item 3"
86+
]
87+
};
8088
}
8189

8290
render() {
8391
return (
8492
<div style={ objStyleCommon }>
8593
<div style={ objStyleContent }>
8694
<ul style={{ display: 'inline-block' }}>
87-
<li>Item 1</li>
88-
<li>Item 2</li>
89-
<li>Item 3</li>
95+
{ this.state.items.map((strItem, index) => (<li>
96+
{ strItem }
97+
</li>)) }
9098
</ul>
9199
</div>
92100
<div>

0 commit comments

Comments
 (0)