title: React JS- else block is not executing inside Map function
body: <p>I am implementing a notification where every 10 secs I am making an api call and based on the response received, I am displaying the notification alert. The issue I am facing here is div is not getting rendered.I am displaying the div based on some condition inside my map function.
  Here, the data is array of objects which I am getting as a response of an api call.For some reasons, I am seeing the else part is never getting executed and I am always getting the div mentioned in if block. I am not sure what I am doing wrong. item.description value will vary based on the logged in user.</p>
  
  <pre><code>getNotificationDetails = (data) =&gt;{ 
      const payloadData = data.payLoad &amp;&amp; data.payLoad.map(item =&gt; {
                  if (item.description == generatedStatus){
                      return 
                      (
                          &lt;div key = {item.id} className="alert alert-warning alert-dismissible show" role="alert"&gt;
                                You have received notification
                              &lt;Link  to='/validated'&gt; {item.extendedAccessKey} &lt;/Link&gt;
                              &lt;button type="button" className="close" data-dismiss="alert" aria-label="Close" onClick={this.updateNotification}&gt;
                                  &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                              &lt;/button&gt;
                          &lt;/div&gt;  
                      )
                  } else {
                      return 
                      (
                          &lt;div key = {item.id} className="alert alert-warning alert-dismissible show" role="alert"&gt;
                                Your detail has been shared with
                              &lt;Link to='/validated'&gt; {item.extendedAccessKey} &lt;/Link&gt;
                              &lt;button type="button" className="close" data-dismiss="alert" aria-label="Close" onClick={this.updateNotification}&gt;
                                  &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                              &lt;/button&gt;
                          &lt;/div&gt;  
                      )
                  }
              })
              return payloadData;
              console.log(payloadData);
  
          }
  render() { 
          const data = this.props.getNotificationStatus;
          console.log(data);
          console.log(data.payLoad);
          const isAccessKeyLinked = Object.keys((data.length === 0))
  
          return (  
              &lt;div className="notification-alert"&gt;
                      {
                          (!isAccessKeyLinked)
                          ?
                          (this.state.isActive  &amp;&amp; this.getNotificationDetails(data))
                          :
                          (this.state.isActive  &amp;&amp; this.getNotificationDetails(data))
                      }
  
  
              &lt;/div&gt;
          );
      }
  </code></pre>