title: React Context components wont update when state changed
body: <p>I am trying to create a react context provider within a functional component. I am using the useState hook to provide an array to other components and have an add function that pushes a new value to the array. The array and the add function are both provided through the context provider.</p>
  
  <p>It seems to be that using push with state hooks by doing</p>
  
  <pre><code>var newArray = array
  newArray.push("text")
  setArray(newArray)
  </code></pre>
  
  <p>does not cause components using the state to rerender but when using</p>
  
  <pre><code>setArray(array=&gt; [...array, "text"])
  </code></pre>
  
  <p>the components using array provided through a context provider do update.</p>
  
  <p>Would anyone be able to explain why this is?</p>