100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
JavaScript

Server Components vs Client Components

Learn how React Server Components and Client Components split rendering work in the Next.js App Router, and when the 'use client' directive is actually needed.

Rendering ModelsIntermediate10 min readJul 10, 2026
Analogies

What Are Server and Client Components?

In the Next.js App Router, every component is a Server Component by default. Server Components render entirely on the server (or at build time), never ship their own JavaScript to the browser, and can directly access backend resources such as databases, the file system, or environment secrets without an API layer in between. A Client Component is created by adding the 'use client' directive at the very top of a file; only then does React hydrate that component in the browser so it can use state, effects, and event handlers.

🏏

Cricket analogy: It's like a match referee (server) making the lbw decision using full stump-camera data nobody in the stands can see, versus the scoreboard operator (client) who only updates the display and reacts to button presses from the crowd.

The 'use client' Boundary

Adding 'use client' to a file marks a boundary in the component tree: that component and everything it imports (unless passed in as children) become part of the client JavaScript bundle. A common mistake is putting 'use client' at the top of a large page and dragging every child import into the bundle. The composition pattern avoids this by passing Server Components down as 'children' or other props into a Client Component wrapper -- the Server Component subtree still renders on the server even though it's nested inside a client boundary.

🏏

Cricket analogy: It's like a franchise signing one overseas star player (the client boundary) but keeping the rest of the domestic squad (server components) on the local roster instead of importing the entire foreign support staff too.

Data Fetching Differences

Server Components can be declared as async functions and await a fetch call or a direct database query right at the top of the function body, with the resolved data flowing straight into JSX -- no useEffect, no loading spinner boilerplate. Client Components cannot be async in this way; they fetch data with useEffect, a library like SWR or TanStack Query, or by receiving already-fetched data as props from a parent Server Component, since the async render model only applies on the server.

🏏

Cricket analogy: A curator (server component) can walk into the pitch report room and read the soil moisture data directly before the match starts, while a commentator (client component) has to wait for someone to radio the update to the booth mid-over.

tsx
// app/products/[id]/page.tsx -- Server Component (default, no directive needed)
import { LikeButton } from './like-button';

async function getProduct(id: string) {
  const res = await fetch(`https://api.example.com/products/${id}`, {
    next: { revalidate: 60 },
  });
  return res.json();
}

export default async function ProductPage({ params }: { params: { id: string } }) {
  const product = await getProduct(params.id);

  return (
    <article>
      <h1>{product.name}</h1>
      <p>{product.description}</p>
      {/* Only this small island hydrates in the browser */}
      <LikeButton productId={product.id} initialLikes={product.likes} />
    </article>
  );
}

// app/products/[id]/like-button.tsx -- Client Component
'use client';
import { useState } from 'react';

export function LikeButton({ productId, initialLikes }: { productId: string; initialLikes: number }) {
  const [likes, setLikes] = useState(initialLikes);
  return (
    <button onClick={() => setLikes((n) => n + 1)}>
       {likes}
    </button>
  );
}

Server Components cannot use useState, useEffect, useContext, browser-only APIs (window, localStorage), or event handlers like onClick. If a component needs any of these, it must be a Client Component, or the interactive part must be extracted into a small child Client Component.

When to Choose Which

The practical rule is to default to Server Components everywhere and only add 'use client' at the leaves of the tree that genuinely need interactivity, local state, effects, or browser APIs -- things like a form input, a dropdown menu, a chart with hover tooltips, or a modal. Keeping data-fetching, layout, and static content in Server Components reduces the JavaScript bundle sent to the browser, improves Time to Interactive, and avoids waterfalls caused by client-side fetching.

🏏

Cricket analogy: A captain doesn't rotate the whole XI every over -- only the specific bowler (client component) needed for the situational match-up comes on, while the rest of the settled batting line-up (server components) stays put.

Marking a high-level layout or page component with 'use client' just to use one small piece of state can accidentally convert the entire subtree into client-rendered code, ballooning your JavaScript bundle. Push 'use client' as far down the tree as possible.

  • Server Components are the default in the App Router; they render on the server and ship no JS to the browser.
  • 'use client' at the top of a file marks a boundary; the component and its direct imports join the client bundle.
  • Passing Server Components as children/props into Client Components keeps them server-rendered even when nested inside a client boundary.
  • Server Components can be async functions that await fetch/database calls directly; Client Components need useEffect or a data library.
  • Client Components are required for useState, useEffect, useContext, event handlers, and browser-only APIs.
  • Best practice: default to Server Components, and push 'use client' down to the smallest interactive leaf possible.
  • Overusing 'use client' at high levels of the tree inflates the JavaScript bundle and hurts performance.

Practice what you learned

Was this page helpful?

Topics covered

#JavaScript#NextJsStudyNotes#WebDevelopment#ServerComponentsVsClientComponents#Server#Components#Client#Boundary#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse