Introduction:
In a recent video on the popular French web development YouTube channel, grafikart.fr, the creator shared a rather critical perspective on the Next.js framework. Intrigued by their points, I wanted to delve deeper into the arguments presented and offer a summarized reflection on why this experienced developer is choosing to steer clear of this widely adopted technology. This post aims to explore the core issues raised in the grafikart.fr video, including concerns about data duplication, file routing, confusing conventions, Next.js's limitations as a full-stack solution, the opacity of its build process, and potential implications for the evolution of React. Let's unpack the reasons behind this developer's decision to avoid Next.js.
What is Next.js?
For those unfamiliar, Next.js is a React framework that bills itself as a solution for building full-stack web applications. As the grafikart.fr video explains, it offers features like server-side rendering, which can improve SEO and initial load times, and provides a structured approach to React development. It's undeniably popular, used by many developers and companies, and it certainly has its use cases. However, the creator on grafikart.fr raises several fundamental concerns about its underlying architecture and development philosophy.
The Problem with Data Duplication
As highlighted in the grafikart.fr video, a significant concern with Next.js lies in its approach to data fetching and rendering. The video meticulously explains how Next.js utilizes client-side components to generate an initial HTML version on the server. The crux of the issue, according to grafikart.fr, is that for subsequent client-side navigation, a reconciliation phase occurs, necessitating the transfer of data from the server to the client. This effectively means the same data is processed twice – once on the server and again on the client. This duplication, the video argues, introduces inefficiency and can lead to performance bottlenecks, particularly in applications dealing with substantial datasets. The grafikart.fr creator uses the analogy of redundant processing, emphasizing the unnecessary overhead involved in fetching and handling the same information multiple times.
File Routing: A Step Backward
Another aspect of Next.js that the grafikart.fr video critiques is its file-based routing system. The way Next.js dictates URL structures based on folder organization within the pages
directory is presented as a step backward from more flexible and explicit routing solutions. The video argues that this approach can become unwieldy and less intuitive as applications grow in complexity. The grafikart.fr creator expresses a preference for routing mechanisms that offer greater control over URL design and navigational logic, suggesting that the file-based system imposes unnecessary constraints on developers.
Confusing Conventions and "Server Components"
The grafikart.fr video also delves into the specific conventions introduced by Next.js, such as the use of asynchronous functions for components and the relatively new concept of "server components." The video suggests that these additions can introduce confusion, especially for developers already well-versed in traditional React development patterns. It's argued that these Next.js-specific paradigms create an extra layer of abstraction and complexity that might not always be necessary or beneficial. The grafikart.fr creator expresses concern that these evolving conventions could potentially fragment the React ecosystem and create a steeper learning curve for developers.
An Incomplete Full-Stack Framework
While Next.js positions itself as a full-stack framework, the grafikart.fr video argues that it falls short of providing a truly comprehensive solution. The video points out that while Next.js offers a router and rendering functionalities, it lacks built-in solutions for essential backend tasks such as authentication, database integration, and more complex server-side logic. Consequently, developers still need to rely on external libraries and services to handle these critical aspects of a full-stack application. The grafikart.fr creator suggests that this reliance on external tools undermines the notion of Next.js being a self-contained full-stack solution.
The Opacity of the Build Process
A significant point raised in the grafikart.fr video concerns the opacity of the Next.js build process. The video highlights that the underlying logic governing how requests are handled and how code is transformed during the build phase is often hidden from the developer. This lack of transparency, according to the grafikart.fr creator, can make it challenging to diagnose issues, optimize performance, and customize the build process to meet specific project requirements. The video draws an analogy to working with a black box, where the internal workings are concealed, hindering effective debugging and fine-tuning.
The Potential Influence on React
Finally, the grafikart.fr video touches upon the potential influence of Next.js on the future direction of React itself. With the introduction of features like "server components," which have strong ties to Next.js's architecture, the video expresses a concern that React might become increasingly opinionated and deviate from its core principle of being a flexible and unopinionated UI library. The grafikart.fr creator voices a preference for React's foundational flexibility, allowing developers the freedom to choose the tools and libraries that best suit their individual needs and project contexts.
Conclusion:
Ultimately, the perspective shared by the creator on grafikart.fr offers a valuable counterpoint to the often-unquestioning adoption of new web development technologies. Their preference for a more traditional approach, emphasizing clear separation of concerns between server-side rendering and client-side interactivity, resonates with certain development philosophies. While acknowledging the potential benefits of frameworks like Next.js, the points raised about efficiency, flexibility, and transparency are certainly worth considering. This analysis, based on the insights from the grafikart.fr video, encourages a more nuanced discussion about the trade-offs inherent in different web development paradigms. For a more in-depth understanding of these arguments, I highly recommend checking out the original video on the grafikart.fr YouTube channel.