
Improving Data Fetching in Next.js: Lessons from Moving Beyond useEffect
At Subito (Italy's leading classifieds platform), we never paid much attention to how we made API calls in our web frontend microsites , all built on Next.js . We had a simple library based on Axios that handled everything: making requests, modeling data, and managing errors. On the server side, it was a simple call; on the client side, we used useEffect with state management for data and errors. It worked, until we started asking: is this still the right approach? The Wake-Up Call: The Cloudflare Incident The turning point was reading about the Cloudflare outage caused by excessive API calls triggered by useEffect . It made us reflect on our own stack: Are we over-fetching? Are we accidentally triggering duplicate requests? Could we overload our backend without realizing it? The Mission Our primary goal was simple: embrace the standard ! We wanted to align perfectly with the official recommendations from React and Next.js. Since our architecture relies on the Next.js App Router to con
Continue reading on Dev.to React
Opens in a new tab




