title: How to compare an array with a number ReactJS
body: <p>I would like to compare <code>canIBook()</code> with <code>id</code> (increments) in the if statement, but it wont work.</p>
  <p>I suspect I can't compare a number with an array, how would i go about fixing this?</p>
  <p>The method <code>canIBook()</code> currently returns:</p>
  <p>result: [11]</p>
  <pre><code>     const canIBook = () =&gt; {
      const no = freeSlotsList.filter((slot) =&gt; slot.booked === 1);
      const result = no.map((a) =&gt; a.id);
      return { result };
    };
  </code></pre>
  <p>The method with the if-statement:</p>
  <pre><code>const renderTableData = () =&gt; {
  let id = 1;
  const activeButton = () =&gt; {};
  console.log(canIBook());
  return (
    &lt;tr&gt;
      {days.map((val) =&gt; (
        &lt;td&gt;
          {timeSlot.map((n, i) =&gt; {
            if (id === canIBook()) {   //How do i make this true?
              return &lt;h1&gt;Works&lt;/h1&gt;;
            } else {
              return (
                &lt;button id={id++} className={activeButton}&gt;
                  {n} {id}
                &lt;/button&gt;
              );
            }
          })}
        &lt;/td&gt;
      ))}
    &lt;/tr&gt;
  );
  };
  </code></pre>