title: React UseState hook, unable to concatenate arrays
body: <p>I am encountering some strange behavior when attempting to add two arrays together in react.
  Each array chunk has a length of 50 items. My list never grows beyond 50.</p>
  <p>I have tried both with spread operator and concat method, with and without wrapper functions.
  nothing works</p>
  <pre><code>setWordList(wordList =&gt; wordList.concat(msg))
  setWordList(wordList =&gt; [...wordList, msg]) 
  setWordList([...wordList, msg]) 
  setWordList(wordList.concat(msg)) 
  </code></pre>
  <pre><code>  const [wordList, setWordList] = useState([])
    const [isSearching, setIsSearching] = useState(true)
  
  
    
    const loadMoreList = (data) =&gt; {
      console.log(data)
      setIsSearching(true)
      let already = []
      for(let i = 0; i &lt; wordList.length; i++){
        already.push({_id: wordList[i]._id})
      }
      console.log(already)
      socket.current.emit('get word list more', {filter: data.filter, already: already});
    }
  
    
  
    socket.current.on('word list in', (msg) =&gt; {
    
      setWordList(wordList =&gt; [...wordList, msg])
      
      console.log(msg)
      setIsSearching(false)
     
    });
  
  </code></pre>
  <p>Example data(array length = 50)</p>
  <pre><code>[{
  definition: &quot;1. aufhören zu leben, sein Leben beschließen↵Beispiele↵“jung sterben”↵Wendungen, Redensarten, Sprichwörter↵“zum Sterben langweilig, müde, einsam o. Ä....&quot;
  id: &quot;dfe03030-0c50-11ea-afa4-098be982e090&quot;
  leitner_no: 2
  priority: true
  priority_time: 1587986213134
  reviews: 1
  source: &quot;manual&quot;
  source_details: &quot;none&quot;
  time_stamp: 1583402873665
  word: &quot;sterben  | starb, gestorben |&quot;
  _id: &quot;fb99b7c3-34a4-4e63-a98e-41efbbcfe5fc&quot;}]
  
  </code></pre>
  <p>The current list and incoming data never concatenate, the new data seems to replace that in the list already. <code>Console.log</code> of <code>wordList</code> within <code>socket('word list in')</code> returns an empty list regardless of whether there is data rendered from the previous input. Somehow the state appears to not be persisting.
  Any help would be greatly appreciated.</p>