client‑side data fetching, React hooks, SSR vs CSR
you can manually call fetch in a useEffect (not recommended), or lean on popular React libraries in the community (such as SWR or React Query) for client fetching.
Scenario Questions
0-2 years experience
1We have a page that needs to display a list of products fetched from an external API. How would you implement the client‑side fetch in a Next.js component?
2If you use useEffect to call fetch inside a component, what happens during server‑side rendering, and how can you avoid any warnings?
2-5 years experience
1Our feature loads user profile data on the client after the page is rendered, but we notice a flash of empty content. How would you modify the data‑fetching approach to improve perceived performance?
2We switched from fetch to Axios in a client component and started seeing CORS errors that didn't appear before. Walk me through how you'd debug this in a Next.js app.
5-8 years experience
1We need to fetch data on the client for a dashboard that updates every few seconds. Discuss the trade‑offs between using SWR, React Query, or a custom polling hook in a Next.js environment.
2Our application serves millions of users and we want to reduce duplicate API calls from the same client session. How would you design a client‑side caching strategy that works with Next.js's hybrid rendering model?
8+ years experience
1Our legacy monolith uses server‑side rendering for all pages, but we want to gradually migrate high‑traffic pages to client‑side data fetching to leverage edge caching. Outline an architecture plan, including how you'd handle SEO, data consistency, and team coordination.
2We are evaluating whether to move all data fetching to the edge via Next.js Middleware and Edge Functions versus keeping it in the browser. What are the long‑term maintenance and performance implications of each approach?
Follow-up Questions
Why would you prefer useSWR over a plain useEffect fetch?
How does your approach affect SEO and initial page load time?
What would you change if the API started returning 500 errors intermittently?
Sharethis question
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.