0Pricing
Next.js 15 Fullstack (App Router + Server Actions) · Ders

RSC ve RCC'yi Anlama

Next.js 15'te React Sunucu Bileşenleri (RSC) ile React İstemci Bileşenlerinin (RCC) temel farklarını ve avantajlarını kavrayın.

RSC ve RCC'yi Anlama, CoddyKit'te ücretsiz bir Next.js 15 Fullstack (App Router + Server Actions) dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Next.js 15 Fullstack (App Router + Server Actions) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Next.js 15 Fullstack (App Router + Server Actions) kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Welcome to Next.js Components!

In Next.js 15, building user interfaces relies heavily on React components. But there's a new twist!

  • Traditionally, all React components run in the user's browser.
  • Next.js 15 introduces two main types: Server Components (RSC) and Client Components (RCC).
  • Understanding their differences is crucial for building fast, efficient, and interactive Next.js applications. Let's dive in!

What are Server Components (RSC)?

React Server Components (RSC) are components that run exclusively on the server, before any JavaScript is sent to the browser.

  • They generate HTML directly on the server.
  • This HTML is then sent to the client, along with any necessary client-side JavaScript for interactive parts.
  • RSCs are the default component type in the Next.js App Router.

RSC in Action: A Simple Header

Here's a basic component. Since there's no 'use client' directive and no interactive features (like state or event handlers), Next.js treats this as a Server Component by default.

It runs on the server, renders its HTML, and that's what the browser receives.

import React from 'react';

interface HeaderProps {
  title: string;
}

export default function Header({ title }: HeaderProps) {
  return (
    <header>
      <h1>{title}</h1>
      <p>Welcome to our page!</p>
    </header>
  );
}

Benefits of Server Components

RSCs offer significant advantages for performance and efficiency:

  • Zero Client JS: They don't add to the client-side JavaScript bundle, leading to faster page loads.
  • Direct Server Access: Can directly access server resources (like databases or file systems) without needing client-side API calls.
  • Improved SEO: Content is rendered on the server, making it easily crawlable by search engines.
  • Enhanced Security: Sensitive logic and data fetching stay on the server.

What are Client Components (RCC)?

React Client Components (RCC) are what you're likely familiar with – they run entirely in the user's browser, just like traditional React components.

  • They enable interactivity, client-side state management, and access to browser-specific APIs (like localStorage or navigator).
  • RCCs require JavaScript to be downloaded and executed in the browser.

RCC in Action: An Interactive Button

This component uses useState to manage a counter and an event handler to update it. Because it needs client-side interactivity, we mark it with 'use client'.

This directive tells Next.js to send this component's JavaScript to the browser for execution.

'use client';

import React, { useState } from 'react';

export default function CounterButton() {
  const [count, setCount] = useState(0);

  return (
    <button onClick={() => setCount(count + 1)}>
      Clicked {count} times
    </button>
  );
}

The 'use client' Directive

The 'use client' directive is a critical marker in Next.js:

  • It must be placed at the very top of a file, before any imports.
  • It signals to Next.js that this file, and any modules it imports, should be treated as part of the client bundle.
  • This directive acts as a 'boundary' – everything below it, including imported child components (unless explicitly marked as RSCs), will render on the client.

Key Differences at a Glance

Here's a quick comparison of RSCs and RCCs:

  • Execution: RSC (Server), RCC (Browser)
  • Interactivity: RSC (No), RCC (Yes, with hooks/events)
  • State/Effects: RSC (No), RCC (Yes, useState, useEffect)
  • Bundle Size: RSC (Adds zero client JS), RCC (Adds to client JS bundle)
  • Data Access: RSC (Direct server resources), RCC (Needs client-side fetching or props)
  • Directive: RSC (Default, no directive), RCC (Requires 'use client')

When to Use Which Component Type?

Choosing between RSC and RCC depends on your component's needs:

  • Use RSC for: Static content, initial data fetching (e.g., from a database), SEO-critical parts, components that don't need client-side interactivity.
  • Use RCC for: Interactive UI elements (buttons, forms), client-side state management, components requiring browser APIs (e.g., geolocation, local storage), animations.

Often, you'll compose RSCs and RCCs together for a powerful user experience!

Quick Check

Which of the following statements about React Server Components (RSC) and React Client Components (RCC) in Next.js 15 are TRUE?

Recap: RSC & RCC Fundamentals

You've learned the core differences between Server and Client Components in Next.js 15!

  • Server Components (RSC): Run on the server, generate HTML, reduce client JS, are the default.
  • Client Components (RCC): Run in the browser, enable interactivity and state, require the 'use client' directive.
  • Combining them allows you to build highly performant and dynamic web applications.

Next, we'll explore how to fetch data specifically within Server Components efficiently!

Sıkça Sorulan Sorular

“RSC ve RCC'yi Anlama” dersi ücretsiz mi?

Evet — “RSC ve RCC'yi Anlama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Next.js 15 Fullstack (App Router + Server Actions) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Next.js 15 Fullstack (App Router + Server Actions) kursu toplamda 4 dersten oluşur.

“RSC ve RCC'yi Anlama” dersinde ne öğreneceğim?

Next.js 15'te React Sunucu Bileşenleri (RSC) ile React İstemci Bileşenlerinin (RCC) temel farklarını ve avantajlarını kavrayın. Next.js 15 Fullstack (App Router + Server Actions) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Next.js 15 Fullstack (App Router + Server Actions) öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Next.js 15 Fullstack (App Router + Server Actions), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.

“RSC ve RCC'yi Anlama” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Next.js 15 Fullstack (App Router + Server Actions) dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Next.js 15 Fullstack (App Router + Server Actions) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. RSC ve RCC'yi Anlama
  2. RSC'de Veri Alma
  3. RCC ile Etkileşimlilik
  4. Sunucu ve İstemci Bileşenleri için Birleştirme Kalıpları
← Next.js 15 Fullstack (App Router + Server Actions) Sayfasına Dön