Skip to content

Tags

#hooks

Posts tagged #hooks on Dynamo Geeks: 1 post from the community, most useful first.

1 post

Posts tagged #hooks

  1. Question

    why does my useEffect fetch run twice?? deps array is empty

    ok this is probably dumb but i have been staring at it for an hour. i have a component that fetches the users orders when it mounts. deps array is empty so it should only run once right?? but in the network tab i see TWO requests every time useEffect(() => { fetch('/api/orders') .then((res) => res.json()) .then((data) => setOrders(data)) }, []) i console logged inside it and yep, runs twice. react 18 with vite. is…

    Kevin Tran3likes3comments

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.