Im new to React and have an issue with my .map function:
I have a component with the following render function:
render() {
return <div className="sidenav-cont"><ul className="top-level-menu">
{
this.props.loadSidenavItems.map((menuItem) => {
console.log(menuItem.parentCat)
return
(
<li key={menuItem.catId}>
<a href="#">{menuItem.parentCat}</a>
</li>
)
})
}
</ul>
</div>
}
This is the object i'm trying to map:
export default
[
{
catId:"parMenu1",
parentCat:"Genres",
},
{
catId:"parMenu2",
parentCat:"Sound Type",
},
]
My console log returns the two values I want which is great but my no list items get rendered to the DOM. Not sure where i've gone wrong here?
return(there can be some side effects if a newline is before any other statements)