title: How to update data with useState?
body: <p>I'm trying to update the data of an array of objects with a specific index. I get the correct names with <code>console.log(item.name)</code> but it doesn't change the name to 'Test' for instance. Any help is appreciated.</p>
  <pre><code> const [data, setData] = useState(content);
   const content = [
      {
        id: 1,
        name: &quot;First&quot;,
      },
      {
        id: 2,
        name: &quot;Second&quot;,
      },
      {
        id: 3,
        name: &quot;Third&quot;,
      },
    ];
  
    setData(
        content.map((item) =&gt;
          item.id == dataIndex
            ? { ...item, name: &quot;Test&quot; }
            : console.log(item.name)
        )
      );
  </code></pre>