title: How to conditionally output data based on JavaScript object?
body: <p>Any help?
  Let's say i have this array of objects.</p>
  
  <pre><code>const data = {
  post: [
    {
    id: 1,
    name: "lorem A",
    lastseen: 1,
    },
    {
    id: 2,
    name: "lorem B",
    lastseen: 16,
    },
    {
    id: 3,
    name: "lorem C",
    lastseen: 3,
    },
    {
    id: 4,
    name: "lorem D",
    lastseen: 10,
    },
  ]`}
  </code></pre>
  
  <p>I'm working with simple react time component to display "hr" or "hrs".
  How to check if "data.lastseen" value is greater than 1?
  So i can display like this "1 hr" or "2 hrs" </p>
  
  <p>I know to map this but conditionally add and display "hr" or "hrs" to each object I'm having trouble with.</p>
  
  <pre><code>const mapData = data.map((seen) =&gt; seen.lastseen)
  </code></pre>
  
  <p>I googled it to extract values from Object we can use "Object.values()"
  But not sure how to combine with map.</p>
  
  <p><strong>Updated code</strong>
  This is my react component</p>
  
  <pre><code>&lt;Main&gt;
  {Request.data.post.map((user) =&gt; {
      return (
        &lt;Col
        //I'm display other component here 
          &lt;User user={user} /&gt;
        //I'm display other component here 
         &lt;/Col&gt;
      );
  })}
  </code></pre>
  
  <p></p>
  
  <pre><code> const User = ({ user }) =&gt; {
    return (
      &lt;Col&gt;
        &lt;Seen user={user} /&gt;
      &lt;/Col&gt;
    );
  };
  
  
  const Seen = ({ user }) =&gt; {
    return &lt;React.Fragment&gt; {user.map((seen) =&gt;
          seen.lastseen == 1 ? seen.lastseen + "hr" : seen.lastseen + "hrs"
        )}&lt;/React.Fragment&gt;;
  };
  </code></pre>