import React from 'react';
import ReactDOM from 'react-dom';
const App = props => {
const items = ['Bread', 'Milk', 'Eggs', 'Tea'];
return <List items={items} />;
};
const List = props => {
const listItems = props.items.map((item, index) => (
<li key={index}>{item}</li>
));
return <ul>{listItems}</ul>;
};
ReactDOM.render(<App />, document.getElementById('root'));