React Server Components in Next.js: A Beginner's Guide
Request a Quote !

Request a Quote !

Request a Quote !

Blogs

React Server Components in Next.js: What Beginners Should Understand

  • By: admin
  • date: Nov 20, 2026
Blog Image

React Server Components are React components that run only on the server and send finished output to the browser, without shipping their own JavaScript. In Next.js, every component in the App Router is a Server Component by default, so if you’ve started a recent Next.js project, you’ve already used them.

That surprises a lot of beginners, because the React most tutorials teach runs entirely in the browser. This guide explains Server Components in plain language: what they are, how they differ from Client Components, and the mistakes worth avoiding. These are the questions interns ask us most often in the React JS and Next JS at Solitaire Infosystems in Mohali.

What are React Server Components?

 

A React Server Component does its work on the server, turns the result into output, and sends only that output to the browser. Its code never travels to the user’s device.

In the React you probably learned first, every component is downloaded and executed in the browser. Server Components split the work: the server handles whatever it can, and the browser handles only what genuinely needs interaction.

Think of a restaurant. The kitchen (server) cooks the dish, and the waiter brings only the finished plate to your table (browser). You don’t need the recipe, the raw ingredients or the stove at your table.

How are Server Components different from Client Components?

 

Next.js uses both, and choosing between them is the heart of this topic.

 

  Server Components Client Components
How you create one Default in the App Router Add ‘use client’ at the top of the file
Where the code runs Server only Pre-rendered on the server, then runs in the browser
Data fetching Directly with async/await, even from a database Usually through an API or data passed as props
State and events No useState, useEffect or onClick Yes, all of them
JavaScript sent to the browser None for the component itself Included in the bundle
Secrets (API keys, DB queries) Safe, they stay on the server Never put secrets here
Use it for Pages, lists, content, data display Forms, toggles, dropdowns, live search

 

A simple rule works most of the time: if it needs to react to the user, make it a Client Component. If it just shows data, keep it a Server Component.

What does this look like in code?

 

A Server Component can fetch and display data straight away:

 

// app/products/page.js  (Server Component by default)
export default async function Products() {
  const res = await fetch(“https://example.com/api/products”);
  const products = await res.json();
  return (
    <ul>
      {products.map((p) => (
        <li key={p.id}>{p.name}</li>
      ))}
    </ul>
  );
}

 

No useEffect, no hand-built loading state, and no extra JavaScript for this list. The interactive part, such as a like button, goes in its own file:

 

// app/products/LikeButton.js
“use client”;
import { useState } from “react”;
export default function LikeButton() {
  const [liked, setLiked] = useState(false);
  return (
    <button onClick={() => setLiked(!liked)}>
      {liked ? “Liked” : “Like”}
    </button>
  );
}

 

You then place <LikeButton /> inside the Server Component. The page stays mostly server-rendered, and only the button ships JavaScript.

Why do React Server Components matter?

 

  1. Smaller JavaScript bundles. Less code to download means faster pages, especially on budget phones and slow mobile data. It also shortens the “looks ready but won’t click” gap that comes from hydration.
  2. Simpler data fetching. You fetch data where you use it, instead of building loading and error logic in the browser first.
  3. Better security. Database queries and secret keys stay on the server and never show up in the browser.
  4. Faster, crawlable pages. Content arrives as ready HTML with less JavaScript attached, which helps both page speed and how easily search engines read the page.

Are Server Components the same as SSR?

 

No, and this trips up almost every beginner. Server-side rendering (SSR) sends ready HTML to the browser, but the JavaScript for every component still follows and hydrates the page. Server Components go a step further: their code stays on the server and is never sent at all.

The two work together. Client Components are still pre-rendered as HTML on the server for the first view, then hydrated in the browser. Server Components simply skip that second step because they have nothing to hydrate.

What mistakes do beginners make with Server Components?

 

  • Adding ‘use client’ everywhere. It feels like the safe fix when an error appears, but it throws away the main benefit. Use it only where interaction needs it, and push it as far down the component tree as you can.
  • Marking a whole layout ‘use client’. Everything that layout imports gets pulled into the browser bundle. Keep layouts on the server and make only the small interactive pieces Client Components.
  • Confusing ‘use server’ with ‘use client’. ‘use server’ does not create a Server Component (those need no directive). It marks Server Functions, which Client Components can call, for example to submit a form.
  • Using hooks in a Server Component. useState or useEffect without ‘use client’ triggers an error. The fix is usually to move just the interactive part into its own Client Component.
  • Passing ordinary functions as props from server to client. Props crossing that boundary must be serializable: text, numbers, arrays, plain objects, and Server Functions marked ‘use server’. A regular function such as an onClick handler can’t make the trip.
  • Using browser APIs on the server. window, document and localStorage don’t exist in a Server Component, because it never runs in a browser.

 

The official Next.js documentation on Server and Client Components and the React reference for Server Components are worth bookmarking once these basics make sense.

What should beginners learn first?

 

You don’t have to master everything at once. A sensible order:

  1. Get comfortable with basic React: components, props and state
  2. Learn how the Next.js App Router organises pages and layouts
  3. Understand the Server vs Client split and when ‘use client’ is needed
  4. Practise fetching data in Server Components
  5. Learn how caching and revalidation keep that data fresh
  6. Build one small project that mixes both component types

 

If your React basics are solid, the idea itself is quick to grasp. The judgement, knowing where each piece should run, comes from building something and getting it wrong a few times.

Why does this matter for your first developer job?

 

Server Components are how the Next.js App Router works by default, so any Next.js codebase you join will use them. Saying “I know hooks” is common. Explaining why a component should stay on the server, and what that saves the user, shows you understand how the app actually runs.

That’s why the React JS and Next JS internship at Solitaire Infosystems, Mohali teaches it hands-on. Interns build a Next.js project that mixes Server and Client Components and practise explaining every choice they make.

Frequently asked questions

What are React Server Components in simple words?

They are React components that run only on the server and send finished output to the browser, without sending their own JavaScript.

Are Server Components the default in Next.js?

Yes. In the App Router, every component is a Server Component unless its file starts with ‘use client’.

Can I use useState in a Server Component?

No. State, effects and event handlers need the browser, so they belong in Client Components.

Are Server Components better than Client Components?

Neither is better overall. Server Components suit data and static content; Client Components suit interaction. Good Next.js apps use both.

Do I need to know React before learning Server Components?

Yes. Components, props and state make Server Components far easier to follow, because you can see what changes when code moves to the server.

Ready to decide where your code runs?

 

Ask yourself three quick questions:

  1. Do you understand React basics but get stuck when Next.js asks “server or client?”
  2. Do you want to build real projects instead of only watching tutorials?
  3. Do you want to explain your code in an interview, not just run it?

If you said yes to even one, the React JS and Next JS internship at Solitaire Infosystems, Mohali is built for you. Tell us where you are with React  and we’ll suggest a starting point.

About the Author

Comments