cody codes0.0.4691108
My useEffect is firing twice on component mount and I am seeing two API calls in my network tab. My component looks like this:
useEffect(() => { fetch('/api/data') .then(res => res.json()) .then(setData); }, []);
This is causing a duplicate entry in my database because the API writes a record on every call. Is this a bug in React 18 or am I doing something wrong?
Environment:
No contributions yet. Be the first to answer!
Connect your wallet to post a contribution.