title: Move first item to last position of an array with setInterval() in React
body: <p>I am trying to move the first item of an array to the last position of the array in React, using a <code>setInterval</code> function:</p>
  <pre><code>const [cardOrder, setCardOrder] = useState([card1, card2, card3, card4]);
  setInterval(() =&gt; {
      setCardOrder(cards.push(cards.shift()))
  }, 3000); 
  </code></pre>
  <p>The first time always works, but the second time I get</p>
  <pre><code>TypeError: cardsOrder.shift is not a function
  </code></pre>
  <p>How can I achieve this result? All help appreciated. Thanks.</p>