I have a simple method which returns jsx that looks as follows:
renderNewsItems = newsItems => {
return(
newsItems.map(newsItem =>
<NewsItem title={newsItem.title} imageUrl={newsItem.imageUrl} />)
);
}
and this works fine however when I try to add markup to layout the individual <NewsItem /> components, I'm struggling to figure out how to get it to work. My current, broken attempt looks as follows:
renderNewsItems = newsItems => {
return(
<div className="row">
newsItems.map(newsItem =>
<div className="col-4">
<NewsItem title={newsItem.title} imageUrl={newsItem.imageUrl} />
</div>
</div>
);
}
which results in the error:
'newsItem' is not defined no-undef
In case it's not clear, I'm trying to use the bootstrap grid system to set the layout for how my individual <NewsItem/> components should be rendered