I'm creating a simple todo app in react. I have three components. The component in charge of displaying the items ('Item' component) is displaying the bullets but not the text. Here's my code, (edit)
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = { list: [] };
this.addItem = this.addItem.bind(this);
}
addItem(val) {
let updated = [...this.state.list, val];
this.setState({ list: updated });
}
render() {
return (
<div className="App">
<Title itemCount={this.state.list.length}></Title>
<Add addItem={this.addItem}></Add>
<Items items={this.state.list}></Items>
</div>
);
}
}
//Items.js
const Items = ({ items }) => {
return (
<div className="Items">
<ul>{items.map((item, index) =>
<li key={index}>
{item.text}
</li>
)}
</ul>
</div>
);
};
How can I make it display the text? Thanks in advance!

.map(..return statement as single line or wrap JSX part into()textfield? maybe the problem is in theAddcomponent