{this.state.items.map((item, index) => (
))}
);
}
}
export default TodoList;
```
---
# We need state to store the items
```jsx
class TodoList extends Component {
constructor() {
super();
this.state = {
items: []
};
}
...
```
---
# Now we need functionality
```jsx
class TodoList extends Component {
constructor() {
super();
this.state = {
items: []
};
}
addItem = (newItem) => {
this.setState({ items: [...this.state.items, newItem] });
};
render() {
return (