title: React hooks state does not update after deleting
body: <p>So my state does not update immediatly after deleting an item. I have tried to filter games inside of onDelete. Like setGames(games.filter(game =&gt; game.urlSlug !== urlSlug)) but with no success.Does anyone have any ideas? :)</p>
  <pre><code>const [games, setGames] = useState([]);
  
  useEffect(() =&gt; {
    getGames();
  }, [])
  
  const getGames = async () =&gt; {
    await fetch('http://localhost:5000/api/admin/games')
    .then((result) =&gt; {
      result.json().then((resp) =&gt; {
        setGames(resp)
      })
    })
  }
  
  const onDelete = async (urlSlug) =&gt; {
    await fetch(`http://localhost:5000/api/admin/games/${urlSlug}`, {
      method: 'DELETE'
    }).then((res) =&gt; {
      res.json().then((data) =&gt; {
       getGames();
      })
    })
  </code></pre>
  <p>[][1]</p>
  <p>This is my backend in node.js</p>
  <p>router.delete(&quot;/games/:urlslug&quot;, async (req, res, next)  =&gt; {</p>
  <pre><code>const {urlslug} = req.params;
  const db = req.app.locals.db;
  
  try {
  
  const sql = `
  DELETE FROM game WHERE urlslug = $1
  `;
  
  await db.query(sql, [urlslug])
  // res.status(404).send();
  return true;
  
  }
  catch(error) {
    console.error(error);
    return false;
  }
  </code></pre>
  <p>});</p>