DEV Community

Mittal Technologies
Mittal Technologies

Posted on

Server Components in Next.js: What Actually Changes About How You Build (And What Doesn't)


I want to tell you that React Server Components completely changed how I think about building web applications, but I want to be more honest than that. What they actually did is make me rethink some assumptions I'd been carrying for years without questioning — which is more interesting, if less dramatic.
The mental model shift is real but it's specific. For most of the React era, the default was: render on the client, fetch on the client, manage state on the client. Server-side rendering existed, but it was often an optimization bolted on rather than a native way of thinking about components. Server Components flip this. The default, in a properly set up Next.js 13+ App Router project, is that components render on the server unless you explicitly opt into client-side rendering. That's a genuinely different starting point.
What does this mean practically? Server Components can do things that were previously only possible with data fetching hooks or getServerSideProps: directly query a database, read from the filesystem, access environment variables without exposing them to the browser, fetch from APIs without the data appearing in the client bundle. And they do this as a natural part of the component itself, not through a separate data-fetching mechanism that has to be coordinated with the component.
Here's a concrete example. Imagine a product page that needs pricing data, inventory data, and review data from three different sources. In the old world, you'd either have one getServerSideProps function making three requests (or trying to parallelize them), or you'd be doing client-side fetching with loading states for each piece. With Server Components, you can have three separate components each responsible for their own data, fetched concurrently on the server, with streaming to the browser as each piece resolves. The code is more modular and the user experience is better.
The bundle size implications are significant. Server Components never appear in the JavaScript bundle sent to the browser because they never run in the browser. A component that imports a heavy markdown parser, a date formatting library, and a syntax highlighter is doing all of that work on the server — the browser gets HTML. For applications that have grown heavy JavaScript bundles over time, this can produce dramatic performance improvements.
What doesn't change: anything requiring interactivity, browser APIs, or React state and effects. Those stay as Client Components, which work exactly as React components always have. The architecture becomes a composition of Server and Client Components, with data flowing from server to client but not the reverse. Getting comfortable with where that boundary lives — what belongs on the server and what requires the client — is the main learning curve.
The patterns around data mutation are still evolving, but Server Actions (functions that run on the server, callable from Client Components) are the current recommended approach for form submissions and mutations. They work well for typical CRUD operations and reduce the boilerplate of building API routes for internal operations.
For teams that develop mobile apps as well as web applications, the same architectural principles apply: components should live where their dependencies live, data fetching should happen close to the data source, and the client should only get the data it needs. A good mobile app development company India approaches React Native projects with similar principles: minimize what has to happen on the client, keep business logic where it can be tested and maintained, and design the data flow deliberately.
The honest advice I'd give to someone starting a new Next.js project: start with Server Components as the default and add 'use client' only where you genuinely need it. Don't try to preplan which components are which — you'll figure it out as you build. The compiler will tell you when you're trying to do something that requires client-side APIs in a Server Component. And invest time in understanding the caching behavior early, because Next.js's caching model is powerful and not entirely intuitive until you've seen it in action a few times.

Top comments (0)