title: How to update an array of objects when variable state changes?
body: <pre><code>  useEffect(() =&gt; {
      setFilteredFeed(allFeed.filter((obj) =&gt; obj.name === { selectedName }));
    }, [selectedName]);
    ...
  
    return (
      &lt;&gt;
       {filteredFeed.map((e, i) =&gt; (
          &lt;FeedByUser e={e} key={i} /&gt;
        ))}
      &lt;/&gt;
    );
  </code></pre>
  <p>It only works when I hard code:</p>
  <pre><code>setFilteredFeed(allFeed.filter((obj) =&gt; obj.name === &quot;John Doe&quot;));
  </code></pre>
  <p>When <code>selectedName</code> state changes, the <code>FeedByUser</code> component should also change.</p>
  <p>Edit: typo - key</p>