Nov 2026 · Guide · ~8 min read
Stop Fetching Data in useEffect
By Safdar Ali — frontend engineer, Bengaluru
I'm Safdar Ali. useEffect runs after the browser paints. A fetch inside it means the first paint is empty on purpose. You then write isLoading, a race when the id changes, and a cleanup flag so a slow response does not set state on an unmounted screen.
If the data is known when the page renders, fetch it on the server and pass it in. The HTML includes the content. There is no loading flag for the initial view. This is the default in the App Router.
An effect fetch is still reasonable for data that depends on the browser only: a measurement, a client-only subscription, something you cannot know at request time. Even then, cancel or ignore the stale response. The id in the dependency array is not optional.
A waterfall is two of these in a row: the page fetches a user, then a child effect fetches their projects. Both could have been one server render. I look for that pattern in review before I look at memo.
The useEffect mistakes post lists the other ways the hook goes wrong. Data loading is the one that hurts the first impression of the page.
If this helped you
I publish free tutorials and write-ups like this in my spare time — no paywall on the guides. If it saved you an afternoon of trial and error, you can support the work:
- Buy me a coffee at buymeacoffee.com/safdarali
- Subscribe to my YouTube channel — it's free; 70+ React & Next.js tutorials
Related reading
More guides on safdarali.in — same author, production-focused.
- Guide
How to Build a Frontend Developer Portfolio That Stands Out
Frontend developer portfolio guide for India — sections, React/Next.js examples, SEO, performance, personal branding, FAQ, and checklist to build and rank.
May 2026Read article →
- Guide
React Server Components vs Client Components — When to Use Which
Practical RSC vs client guide for Next.js App Router — when to use each, real code, bundle before/after, and performance impact.
May 2026Read article →