title: Appending array with useState hook not working as expected
body: <p>I am using the below code and expect that I will recieve an array of multiple objects as I am using "...". </p>
  
  <pre><code>const [csv, setCsv] = useState([]);
  
  useEffect(() =&gt; {
      d3.csv(fileName, function(fileContents) { setCsv(
          [...csv,{
              'key': fileContents['Licenseno'],
              'First Name': fileContents['First Name'],
              'Address': fileContents['Street #'] + " " + fileContents['Stname'] + " " + fileContents['Suffix'] + " " + '0' + fileContents['Zip']
          }]);
      });
  },[])
  </code></pre>
  
  <p>Instead, console.log reveals that csv[] is being re-written for every fileName row and only ever includes one object at a time. </p>
  
  <p>To see whether this was related to d3 (which I have never used before), I declared a const arrayVar = [] and .appended- this worked the way I wanted. So it seems to be the useState hook... any ideas on how to solve this issue?</p>