title: Why use prevState in React setState function?
body: <p>Please tell me what different using prevState and using Array.filter.</p>
  <pre><code>// components is an array that has object {key: string, item: {}}
  const defaultValue = [
    {
      key: 'a',
      item: {},
    },
    {
      key: 'b',
      item: {},
    },
    {
      key: 'c',
      item: {},
    }
  ];
  const [components, setComponent] =  React.useState(defaultValue);
  
  // using prevState
  setComponents(prevState =&gt; prevState.filter(item =&gt; item.key !== 'b'));
  
  // using Array. filter
  setComponents(components.filter(item =&gt; item.key !== 'b')))
  </code></pre>
  <p>As a result, <code>using Array.filter </code> is not fine working.
  I wondered. The reason is Array.filter returns a new array.</p>
  <p>Please tell me what different using prevState and using Array.filter </p>