class Header extends React.Component {
constructor() {
super();
this.state = {
items: [
{ name: 'Google', link: 'https://google.com' },
{ name: 'Yandex', link: 'https://yandex.com' }
] };
}
render() {
const list = this.state.items.map((item, index) => {
return <li key={index}><a href={item.link}>{item.name}</a></li>;
});
return <ul>
{list}
</ul>;
}
}