4 ms·
As someone who recently reviewed a codebase that was refactored to Next - I think there are a ton of footguns that people don’t really think about. I think many
by kamranjon 2y ago
As someone who recently reviewed a codebase that was refactored to Next - I think there are a ton of footguns that people don’t really think about. I think many people think they can just turn on server side rendering and get “fast” apps.
For example, by moving all of your front ends service calls to the backend you basically bottleneck your initial page load in waiting for those calls to resolve. Time to first paint can absolutely tank, and this is a pretty important perceived performance metric that impacts interactivity.
I’ve also found that developers who moved to Next don’t really have a clear understanding of how to handle application state management on the front end now that redux has fallen out of style. Excessive service calls (requesting data you’ve already fetched in other components) has ballooned to levels I’ve never seen before. And because all of these calls are happening on the backend, it’s not obvious to developers when they are making excessive calls because they can’t see the requests in the network tab of any modern browser.
So now they need to start thinking about a cache because the performance feels so much worse. Luckily Vercel can sell you this service - this adds another layer of complexity, but it solves their problem and they proclaim that Next is some hyper performant framework.
Now I know there are very efficient ways to do server side rendering, and properly using the new server components in Next and managing state… but the paradigm is so much different that I think many developers miss that step and actually degrade the performance of their applications when trying to migrate to this new framework of server side rendering.
I might be old fashioned but I do think this “new” server side rendering approach adds a lot of complexity for not a whole lot of gain, but I am still excited to learn more about Next and understand the best practices when using this style of app.