From c3f4147944930579f15e09a72d754057791c36ef Mon Sep 17 00:00:00 2001 From: Keith D Commiskey Date: Fri, 26 May 2017 18:27:16 -0700 Subject: [PATCH] Added check for bad data (undefined tweet messages) Accounting for bad data -- The tweets that have no messages were throwing errors in the logger and were preventing the entire list from showing. Placing the tweet texts in a string literal also helped to strip bad tweet.text inputs as well. --- 5-redux-react/src/js/components/Layout.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/5-redux-react/src/js/components/Layout.js b/5-redux-react/src/js/components/Layout.js index 8d416cd7..9f55cda5 100644 --- a/5-redux-react/src/js/components/Layout.js +++ b/5-redux-react/src/js/components/Layout.js @@ -27,7 +27,12 @@ export default class Layout extends React.Component { return } - const mappedTweets = tweets.map(tweet =>
  • {tweet.text}
  • ) + const mappedTweets = tweets.map(tweet => { + return ((typeof(tweet.text) === 'undefined') + ? false + :
  • {`${tweet.text}`}
  • + ) + }) return

    {user.name}