title: When setting state using useState, what's the difference between an arrow func without prevState and a prepared data
body: <p>There is a disvergence between my colleague and me
  when setting state, I chose to write this way</p>
  
  <pre><code>const [data, setData] = useState()
  
  setSeriesData(() =&gt; {
    const arr = []
    for (const [k, v] of Object.entries(foo)) {
      arr.push({ k: v })
    }
    return arr
  })
  </code></pre>
  
  <p>but he think if I don't use prevState, I shouldn't use arrow func here and should write the assignment logic outside like this</p>
  
  <pre><code>const arr = []
  for (const [k, v] of Object.entries(foo)) {
    arr.push({ k: v })
  }
  setSeriesData(arr)
  </code></pre>
  
  <p>But we both don't know what happens when using arrow func without prevState.
  Does it need more operations?
  Can anybody answer this question?</p>