I have that part of code
const links = [
{
name: 'How it works',
ref: '/'
},
{
name: 'Calendar',
ref: 'calendar'
},
{
name: 'Contact me',
ref: 'contact'
}
];
const renderLinks = links.map((link, index) =>
<li className="nav-item active" key={index}>
<a className="nav-link" href={link.ref || "#"}>
{link.name}
</a>
</li>
);
However when I try to render it an error is thrown.
render() {
return (
{renderLinks}
);
}
Objects are not valid as a React child (found: object with keys {renderLinks}). If you meant to render a collection of children, use an array instead.
As I think, I have to got an array but React thinks there is an object.
return renderLinks;