title: Removing an specific item from an array in React
body: <p>i have this code <a href="https://stackblitz.com/edit/react-wc2ons?file=src%2FSection.js" rel="nofollow noreferrer">https://stackblitz.com/edit/react-wc2ons?file=src%2FSection.js</a></p>
  <p>I have sections, and i can add items to those sections. How can i delete some item? I tried</p>
  <pre><code>const removeItem = (i) =&gt; {
      setSections((section) =&gt; {
        const itemTarget = section.items[i];
        const filtered = section.items.filter((item) =&gt; item !== itemTarget);
        return {
          ...section,
          items: filtered,
        };
      });
    };
  </code></pre>
  <p>But for some reason it doesn't work</p>