This commit is contained in:
2021-07-26 13:48:08 +10:00
parent 2919467dff
commit 6d0dd419ca
+15 -1
View File
@@ -26,7 +26,21 @@ const NewsFeed = props => {
return ( return (
<div> <div>
<h1 className='centered'>News Feed</h1> <h1 className='centered'>News Feed</h1>
{articles.map((article, index) => { {(articles || []).map((article, index) => {
//BUGFIX: check for empty data
if (!article.title) {
return article.title = '';
}
if (!article.author) {
return article.author = '';
}
if (!article.body) {
return article.body = '';
}
//render
return ( return (
<div key={index}> <div key={index}>
<hr /> <hr />