Nova povijest

Reactove nove komponente poslužitelja mogle bi biti smrt poplavljenih web aplikacija

po Gianna Song16m2025/04/24
Read on Terminal Reader

Predugo; Čitati

Saznajte kako dizajnirati moderne aplikacije React pomoću React Server Components (RSC), SSR i CSR u Next.js 15.
featured image - Reactove nove komponente poslužitelja mogle bi biti smrt poplavljenih web aplikacija
Gianna Song HackerNoon profile picture
0-item


(*Ako želite preskočiti naprijed i uroniti izravno u tehnički raspad, preskočite na 1. zašto su predstavljene komponente React Servera.)


In the early 2010s, React revolutionized frontend development with its declarative component model and efficient virtual DOM diffing. What began as a simple view library soon became the backbone for large-scale single-page applications (SPAs). These SPAs predominantly used Client-Side Rendering (CSR), meaning the browser would download a JavaScript bundle, execute it, and construct the UI entirely on the client.


This client-centric model was flexible and highly interactive, and it defined “modern” web apps for years. However, as applications grew more complex and feature-rich, the CSR approach started to show its cracks:


  • Longer Time-to-Interactive (TTI): Hefty JavaScript bundles and client-side work meant users waited longer before they could actually interact with the page.

  • Svijet
  • Hydration bottlenecks: Converting server-rendered HTML into an interactive app (hydration) became a performance choke point, especially as the amount of dynamic content increased.

  • Svijet
  • Napuhani paketi: Aplikacije često isporučuju mnogo više JavaScript-a nego što je potrebno, opterećujući preglednike kodom za značajke ili sadržaj koji bi se mogao isporučiti učinkovitije.
  • Svijet
  • Izvrsnost koja se ne povećava: Što je aplikacija veća i složenija, to je teže održavati brzu izvedbu na svim uređajima i mrežnim uvjetima.

Next.js se pojavio kako bi riješio neke od tih bolnih točaka uvođenjem Server-Side Rendering (SSR), Static Site Generation (SSG) i drugih optimizacija. Te tehnike poboljšale su početno vrijeme učitavanja i odložile dio UI renderinga na poslužitelju.


S Next.js 15 koji se pokreće na React 19, nova paradigma prikazivanja preuzela je središnju fazu:React Server Components (RSC). RSCs allow developers to seamlessly blend server-rendered and client-rendered components in a single React tree. The implications are significant. Static parts of the UI can now be delivered as pure HTML with zero JavaScript overheadDrugim riječima, za te odjeljke nije potrebna hidracija na strani klijenta. Logika prikupljanja podataka također se pojednostavljuje pokretanjem unutar komponenti poslužitelja, eliminirajući mnoge nepotrebne API pozive iz preglednika. Rezultat: tanji paketi na strani klijenta, brže interakcije i aplikacija koja je mnogo učinkovitija i skalabilnija.


Ovaj članak nije pregled na površini RSC-a.Kada sam odlučio napisati o učinkovitom korištenju Next.js-a 2025. godine, brzo je postalo jasno da React Server Components zaslužuje posvećeno duboko uronjenje.Što slijedi je tehnički strogo istraživanje kako RSC radi pod poklopcem, kako ga iskoristiti u projektu Next.js 15 i zašto predstavlja temeljnu promjenu u frontend arhitekturi.


By the end, I hope you come away with the same clarity and appreciation for RSC that I did through the process of researching and writing this piece.

Intro: From CSR to RSC — How Rendering Evolved in React

Intro: From CSR to RSC — How Rendering Evolved in React

Over the past decade, the way we build React applications has fundamentally evolved and with it, the way we think about rendering.

Kratka povijest Client-Side Rendering (CSR) u React-u

React gained its popularity through Client-Side Rendering (CSR) — a model where the browser downloads JavaScript, executes it, and builds the entire UI on the client. This approach gave developers full control over interactivity and state, and made it easy to build dynamic single-page applications (SPAs).


Međutim, CSR je došao s značajnim kompromisima:

    Svijet
  • Slower initial loads, especially on mobile or poor networks
  • Poor SEO for content-driven pages
  • JavaScript-heavy bundles — even for pages with minimal interactivity
  • Svijet
  • Potreban je korak hidracije nakon učitavanja HTML-a, odgađajući vrijeme interaktivnosti
  • Svijet


For a while, these limitations were just “how things were.” Then Next.js changed the game.

🚀 How Next.js brought SSR and SSG to mainstream React development

When Next.jsNakon što je ušao u scenu, uveo je rendering sa strane poslužitelja (SSR) i static site generation (SSG) kao građane prve klase za React.


  • SSR je omogućio da se stranice generiraju po zahtjevu, poboljšavajući SEO i brzinu učitavanja za dinamični sadržaj.
  • SSG je omogućio pretvaranje sadržaja u vrijeme implementacije, savršeno za blogove, dokumente i marketinške stranice.
  • Incremental Static Regeneration (ISR) pomogao je ukloniti rupu tako što je omogućio ažuriranje statičkih stranica nakon implementacije.


Ova fleksibilnost pomogla je programerima postići bolju ravnotežu između performansi, SEO-a i iskustva programera.


But even with SSR and SSG, there was still a lingering issue: we were still sending too much JavaScript to the browser– čak i za komponente koje nisu trebale biti interaktivne.

Porast React Server Components (RSC) u 2025. godini

Uz oslobađanjeNext.js 15 and React 19, we’ve entered a new era: React Server Components (RSC)To je sada ključni dio načina na koji gradimo aplikacije.


Unlike SSR, which still requires hydration and ships JavaScript to the client, RSC allows you to render components on the server — without sending any JavaScript to the browser at all. u


To je velika promjena:

  • Components can now access server-side data directly
  • Static content doesn’t require hydration
  • You can mix server and client components in a single React tree, composing your rendering strategy per component


RSC ne zamjenjuje SSR ili SSG.complements them, unlocking finer-grained control over performance, bundle size, and rendering behavior.


In 2025, RSC is a foundational concept that every senior React engineer needs to master.

1. Why React Server Components Were Introduced

1. Why React Server Components Were Introduced

As React applications became more complex, the industry began to feel the weight of its success. While Client-Side Rendering (CSR), Server-Side Rendering (SSR), and Static Site Generation (SSG) offered different strategies for building performant web apps, each of them carried trade-offs that grew more apparent at scale.

🚧 Limitations of CSR, SSR, and SSG

1. Hydration overhead

Even with SSR or SSG, once HTML reaches the browser, React needs to “hydrate” the page — attach event listeners, reinitialize components, and effectively rebuild the app in memory. For large component trees, hydration can be a major bottleneck for Time-To-Interactive (TTI).

2. JavaScript bundle bloat

S CSR-om, svaka komponenta, korisnička oprema i API poziv koji je dio stranice mora biti poslan u preglednik – bez obzira je li interaktivan ili ne. SSR i SSG to malo smanjuju, ali većina paketa još uvijek mora biti izvršena na klijentu.

3. Disconnected data-fetching logic

In the pre-RSC world, data lived outside the components that rendered it. You had to use getServerSidePropsiligetStaticProps (or call APIs in useEffect) to fetch data, then pass it into components via props. This separation added cognitive overhead and made code harder to co-locate and reuse.

Koje probleme je RSC dizajniran za rješavanje

React Server Components (RSC) stvoreni su za rješavanje tih rastućih bolnih točaka s jednostavnom, ali snažnom idejom:let components execute on the server by default, and only send JavaScript to the browser when it’s absolutely necessary.


Eliminate unnecessary JavaScript

RSC allows components to be rendered server-side without shipping any of their logic to the client. If a component doesn’t require interactivity, there’s no need to hydrate or load its JS bundle at all.


Server-side data access within the component tree

RSC uklanja umjetnu granicu između prikupljanja i prikazivanja podataka.async/await to directly access databases, file systems, or APIs — co-locating data and view logic naturally, with no need for API routes or prop drilling.


Improve rendering efficiency and developer experience

By moving non-interactive logic to the server, developers can build lighter apps with smaller bundles and better performance. RSC also simplifies the mental model — you just write components, and let the framework handle where they run and how they ship.


RSC doesn’t aim to replace SSR or SSG, instead, it complements them. It lets you think at the component level, not just the page level, about what should run on the server and what belongs in the browser.


In short: React Server Components were designed to bring modern frontend development back to its lean, fast, and maintainable roots without compromising interactivity.

2. Rendering Strategies in Next.js 15: RSC vs SSR vs CSR

2. Rendering Strategies in Next.js 15: RSC vs SSR vs CSR

Next.js 15 offers developers a granular rendering model that goes far beyond traditional page-level strategies. With React Server Components (RSC) becoming a first-class concept, it’s essential to understand how they compare to two familiar models: Server-Side Rendering (SSR)iClient-Side Rendering (CSR).


While SSG (Static Site Generation) is still valuable in specific cases, it can be viewed as a caching strategyizgrađen na vrhu SSR-a.RSC vs SSR vs CSR represent distinct runtime rendering paths, and understanding them is crucial for making performance- and architecture-aware decisions in 2025.

💡 Before We Compare: What Do We Mean by "Interactive Component"?

In the context of React and Next.js, an interactive componentTo je bilo koji element kojirequires client-side JavaScript to respond to user input or browser events.


This includes (but is not limited to):

  • Buttons that update state on click

  • Oblici s validacijom ili kontroliranim ulazima
  • Dropdowns i modali koji se prebacuju otvoreno/zatvoreno
  • Animations triggered by scrolling or hover

  • Kartuše, karoserije, filteri i slajdovi
  • Komponente koje koriste useState, useEffect ili useReducer

If a component has event handlers, internal state, or relies on the DOM or browser APIs, it must run on the client.


Interactivity = Browser-side behavior + JS event listeners + local state.


Understanding this distinction helps clarify why RSC exists: to avoid shipping JavaScript for UI pieces that don’t need to be interactive.

🧩 Rendering Models at a Glance

SvijetSvijetSvijetSvijet

Feature

RSC (React Server Components)

SSR (Server-Side Rendering)

CSR (Client-Side Rendering)

Render location

Server

Server

Client

JavaScript sent to browser

❌ None

✅ Yes

✅ Yes

Requires hydration

❌ No

✅ Yes

✅ Yes

Interactivity

❌ No

✅ Full

✅ Full

Access to server resources

✅ Direct

✅ Via getServerSideProps

❌ Needs API calls

When it runs

On-demand or streamed

Per request

On load in browser

Ideal use case

Static or data-bound views

Personalized or dynamic UI

Interactive flows, local UX

Feature

RSC (react server komponente)

SSR (Rendering na strani poslužitelja)SvijetSvijet

CSR (Rendering sa strane klijenta)

Povjerite lokaciju

ServeriSvijet

Server

Svijet

Klijent

Svijet

JavaScript sent to browser

❌ None

Svijet

✅ Yes

Da

Zahtijeva hidrataciju Ne ✅ Da ✅ DaSvijetInteraktivnost Ne ✅ Cijeli ✅ CijeliPristup resursima poslužitelja ✅ Izravno ✅ Preko getServerSideProps ❌ Potreban je poziv API-ja

Kad teče

On-Demand ili StreamedSvijetNa zahtjev

Preuzimanje u browser

Idealni slučajevi korištenja Static ili data-bound pogledi Personalizirani ili dinamični UI Interaktivni tokovi, lokalni UXSvijet

Feature

RSC (React Server Components)

SSR (Rendering na strani poslužitelja)Svijet

CSR (Rendering sa strane klijenta)

Feature

Feature

RSC (react server komponente)

RSC (React Server Components)

SSR (Server-Side Rendering)

SSR (Server-Side Rendering)

Svijet

CSR (Rendering sa strane klijenta)

CSR (Rendering sa strane klijenta)

Povjerite lokaciju

ServeriSvijet

Server

Svijet

Client

Povjerite lokaciju

Povjerite lokaciju

Server

Serveri

Svijet

Server

Server

Client

Klijent

Svijet

JavaScript sent to browser

❌ None

✅ Yes

Da

JavaScript sent to browser

JavaScript upućen u browser

❌ None

❌ None

Svijet

✅ Yes

✅ Yes

Da

Da

Requires hydration

❌ No

✅ Yes

✅ Yes

Svijet

Potrebna je hidratacija

Potrebna je hidratacija

❌ No

❌ No

✅ Yes

Da

✅ Yes

✅ Yes

Interaktivnost Ne ✅ Cijeli ✅ Cijeli

interaktivnost

interaktivnost

Ne

Ne

punim

punim

Svijet

✅ Full

✅ Full

Pristup resursima poslužitelja ✅ Izravno ✅ Preko getServerSideProps ❌ Potreban je poziv API-jaSvijet

Pristup resursima servera

Pristup resursima servera

izravno

✅ Direct

✅ preko getServerSideProps

✅ Via getServerSideProps

Treba vam vatreni poziv

Treba vam vatreni poziv

Kad teče

On-Demand ili StreamedSvijetNa zahtjev

Preuzimanje u browser

Svijet

Kad teče

Kad teče

On-Demand ili Streamed

On-demand or streamed

Na zahtjev

Na zahtjev

Preuzimanje u browser

Preuzimanje u browser

Idealni slučajevi korištenja Static ili data-bound pogledi Personalizirani ili dinamični UI Interaktivni tokovi, lokalni UX

Ideal use case

Ideal use case

Static or data-bound views

Static ili data-bound pogledi

Svijet

Personalizirani ili dinamični UI

Personalizirani ili dinamični UI

Interaktivni tokovi, lokalni UX

Interaktivni tokovi, lokalni UX

🔍 Think in Components, Not Just Pages

In earlier versions of Next.js, rendering strategies were applied at the page level. You had getServerSideProps, getStaticPropsŠto god odabrali, primijenili su naCijela stranica. This made sense in a world where rendering happened all-or-nothing — either statically at build time, or dynamically on each request.


But with React Server Components (RSC) and the app/Direktorija je uvedena u Next.js 13+ i standardizirana u 15,rendering is no longer a top-down, one-size-fits-all decision. It becomes a per-component concern that unlocks a new mindset.

🧠 A New Way of Thinking: Declarative and Composable Rendering

This shift is more than an API change, it's a conceptual shift in how you architect your frontend.

Declarative

Instead of orchestrating how and wherekomponente se ručno prikazuju, sada jednostavnodeclare what each component does and what it needs — React and Next.js take care of the rest.


You don’t manually wire up API endpoints or pass props from SSR to components. You can just write:

// Server Component
export default async function ProductInfo() {
  const product = await db.getProduct(slug)
  return <div>{product.name}</div>
}


Ova komponenta:

    Svijet
  • Trčanje na serveru
  • Svijet
  • Doesn’t send JS to the client
  • Ne zahtijeva bilo koji getServerSideProps ili API sloj
  • Svijet
  • Je li “samo komponenta” – nema potrebe za dodatnom abstrakcijom


Opišite UI i njegove potrebe za podacimadeclaratively, a rendering motor izračunava ostatak.

Composable

Različiti dijelovi vašeg UI-a mogu koristiti različite strategije prikazivanja -on the same page,at the same time, and with minimal overhead.


Na primjer:

// Product page layout
<ProductInfo />           // Server Component (no JS, rendered on the server)
<AddToCartButton />       // Client Component (interactive)
<SimilarProducts />       // Static Component (SSG with revalidation)


Ove komponente žive zajedno u istom drvetu, ali svaka od njih:

  • Radi u različitom okruženju (server, klijent, build)
  • Koristi samo podatke i kod koji mu je potreban
  • Svijet
  • Brodovi točno ono što je potrebno za preglednik - ne više, ne manje


To make this more concrete, I created a minimal demoTo pokazuje kako različite strategije prikazivanja mogu koegzistirati na jednoj stranici.

3. How React Server Components Work Under the Hood

Kako React Server komponente rade pod kapom

React Server Components (RSC) nisu samo nova strategija prikazivanja, već u osnovi mijenjaju način na koji se komponente drveća grade, prikazuju i prenose.how it works behind the scenesi kako to utječe na granice države, interaktivnosti i podataka.

Granica poslužitelja i klijenta: Split React Tree

React aplikacije koje koriste RSC više nisu u potpunosti prikazane na klijentu.component tree is split into two worlds:


    Svijet
  • Sastavni dijelovi poslužitelja: Izvodite samo na poslužitelju. JavaScript se nikad ne šalje pregledniku. Ne može držati lokalno stanje ili pričvrstiti slušalice događaja. Savršeno za renderiranje statičkog sadržaja i logike vezane za poslužitelj (npr. pristup DB-u).
  • Svijet
  • Komponente klijenta: moraju biti izričito označene "koristite klijenta". Oni su kompilirani u preglednik-prijateljski JavaScript i podržavaju punu interaktivnost, lokalno stanje, useEffect i upravljanje događajima.


U fazi izgradnje ili vođenja, React gradi stablo u kojem su komponente poslužitelja i klijenta koegzistirane i spaja ih tijekom renderiranja.


Što"use client"Zapravo čini

When you add "use client"na datoteku, označava da cijeli modul i njegovi izvozi kaoclient-onlyU pozadini scene, to upućuje Next.js izgradnju cijevi na:


    Svijet
  • Compile that file (and its dependencies) into a separate JavaScript bundle
  • Svijet
  • Exclude that component from being run on the server
  • Treat it like a classic React CSR component with hydration logic
  • Svijet


This directive acts as a boundary marker between the two sides of the tree. All components above it can be server-rendered; all components below it must be rendered in the browser.

Streaming: prikazivanje u komadima, a ne sve odjednom

RSC embraces streaming as a native rendering strategy. Instead of waiting for the full React tree to be built before sending it to the browser, the server streams serialized fragments of UI to the client as they become ready.


    Svijet
  • Komponente poslužitelja prikazuju se i šalju što je prije moguće
  • Svijet
  • Placeholders (e.g. via <Suspense>) fill in temporarily

  • Svijet
  • Komponente klijenta povećavaju hidrataciju, samo kada se napune

✅ How is this possible?


RSC introduces a concept called selective hydration. When a Client Component is rendered within a Server Component tree, React inserts a placeholder (<div data-rsc-placeholder />) and defers hydration.


Nakon što je klijent učitao odgovarajući JS paket:

  1. React lazily loads that specific component
  2. Svijet
  3. Finds the placeholder and stitches it into the live tree
  4. Svijet
  5. Hidrira ga u izolaciji, bez ponovnog prikazivanja cijele stranice
  6. Svijet


Ovaj dizajn jedecoupled and progressiveVaša aplikacija brzo započinje, a interaktivnost dolazi na mrežu postupno.

<Suspense fallback={<LoadingDetails />}>
  <ProductDetails />  // Server Component
</Suspense>

<AddToCartButton />    // Client Component (hydrated later)

Prikupljanje podataka i dijeljenje koda u RSC-u

Još jedna ključna "magija" RSC-a:you can fetch data directly inside components withSvijetasync/awaitBez oslanjanja nagetServerSideProps,useEffect, or manual prop-passing.


// Server Component
export default async function Dashboard() {
  const stats = await getStatsForUser()
  return <StatsView data={stats} />
}


Why is this possible?

  • RSC komponente rade kao stvarne server funkcije, a ne kao moduli kompilirani od strane klijenta
  • Svijet
  • They can access databases, internal APIs, file systems, or anything your server runtime supports
  • The result is rendered HTML (not JS) and streamed to the client
  • Svijet


Also:

  • No hydration needed, since the result is static
  • Svijet
  • No loading UI logic in the component itself — everything resolves before it hits the browser
  • Kod za ovu komponentu se ne šalje klijentu – osim ako nije unutar granice klijenta


To značajno smanjuje veličinu boilerplate i paketa, a logiku zadržava u interfejsu korisnika - dugogodišnji cilj React-a koji je konačno realiziran na razini.

🚫 State, Hooks, and Lifecycle Considerations

RSC does not support traditional React hooks like useState,useEffect, or useRef, because they don’t run in the browser.

Svijet

Feature

Server Component

Client Component

korištenje

useEffect

useContext

✅ (if static)

async/await


❌ (should wrap in effects)

Event handlers

Funkcija Server Client ComponentKorištenjeUčinak

useContext

✅ (ako je statično)

SvijetSvijetSvijetSvijet

async/await


(treba obložiti u efekte)SvijetSvijetDogađajiSvijetFunkcija Server Client ComponentSvijet

Feature

Feature

Svijet

Servisna komponenta

Server Component

Komponente klijenta

Client Component

Korištenjekorištenje

useState

Svijet

Svijet

Svijet

useEffect

Svijet

Učinak

useEffect

Svijet

useContext

✅ (ako je statično)Svijet

useContext

useContext

✅ (ako je statično)

✅ (ako je statično)

SvijetSvijet

async/await


(treba obložiti u efekte)SvijetSvijet

async/await

async/await


❌ (should wrap in effects)

❌ (should wrap in effects)

DogađajiSvijet

Event handlers

Event handlers

Svijet



To osigurava čistu podjelu odgovornosti:

    Svijet
  • Server Components: data and layout
  • Client Components: interactivity and local state

React Server Components are designed to simplify your app. Once you internalize the boundary rules, the streaming model, and async data access, you can compose fast, personalized, and minimal-JS apps with far less boilerplate than before.

4. What’s the Best Practice? Combining RSC, SSR, and SSG

4. What’s the Best Practice? Combining RSC, SSR, and SSG

One of the most common questions React engineers face in Next.js 15 isn’t “should I use RSC?” — it’s “how do I combine RSC with SSR and SSG in a maintainable, high-performance way?”


The beauty of Next.js 15 is that you’re no longer limited to one rendering strategy per page. Instead, you can now compose rendering strategies at the component level, applying the most appropriate approach to each part of the UI.


This section introduces a practical framework for making that decision based on actual architectural needs.

🧭 Start with the Core Question: What does this component need?

Postavite ova četiri pitanja za svaku komponentu:

    Svijet
  1. Does it need to be interactive?
    • ✅ Yes → Use a Client Component
  2. Svijet
  3. Does it need secure, request-specific, or real-time data?
    • ✅ Yes → Consider SSR
  4. Svijet
  5. Can it be precomputed or infrequently updated?
    • ✅ Yes → Prefer SSG
  6. Does it fetch server data but never need to run on the client?
    • ✅ Yes → Use RSC
  7. Svijet

🧩 Example: Product Page Strategy Breakdown

Evo kako se tipična stranica e-trgovine može sastaviti koristeći sva tri strategije:

Komponente Rendering Strategy Razlog ProizvodDetails RSC Pronađeno iz DB-a, bez interaktivnosti, bez potrebe za hidratacijom PriceWithPersonalization SSR Ovisno o korisničkoj sesiji, dinamično po zahtjevu AddToCartButton CSR Zahtijeva interaktivnost i lokalno stanjeRelatedProizvodi SSG (s ISR-om) Sigurno se cache u vrijeme izgradnje, može se ponovno validirati svakih 24 sata ili po oznaki StockStatusBanner RSC + streaming Često se mijenja, prenosi se s suspenzijom kako ne bi blokirao TTFB
Komponente Rendering Strategy Razlog ProizvodDetails RSC Pronađeno iz DB-a, bez interaktivnosti, bez potrebe za hidratacijom PriceWithPersonalization SSR Ovisno o korisničkoj sesiji, dinamično po zahtjevu AddToCartButton CSR Zahtijeva interaktivnost i lokalno stanjeRelatedProizvodi SSG (s ISR-om) Sigurno se cache u vrijeme izgradnje, može se ponovno validirati svakih 24 sata ili po oznaki StockStatusBanner RSC + streaming Često se mijenja, prenosi se s suspenzijom kako ne bi blokirao TTFBkomponentiSvijet

Rendering Strategy

Reason

komponenti

komponenti

Rendering Strategy

Rendering Strategy

Razlog

Reason

Svijet

ProductDetails

RSC

SvijetPreuzeto iz DB-a, bez interaktivnosti, bez potrebe za hidratacijom

ProductDetails

ProductDetails

RSC

RSC

Svijet

Fetched from DB, no interactivity, no need to hydrate

Fetched from DB, no interactivity, no need to hydrate

PriceWithPersonalization

SSR

Depends on user session, dynamic per request

PriceWithPersonalization

PriceWithPersonalization

SSR

SSR

Depends on user session, dynamic per request

Ovisno o korisničkoj sesiji, dinamično na zahtjev

AddToCartButton

CSR

Svijet

Requires interactivity and local state

AddToCartButton

AddToCartButton

CSR

CSR

Requires interactivity and local state

Requires interactivity and local state

Povezani proizvodiSvijet

SSG (with ISR)

SvijetSigurno se pohranjuje tijekom izgradnje, može se ponovno validirati svakih 24 sata ili po oznaki

RelatedProducts

RelatedProducts

Svijet

SSG (with ISR)

SSG (with ISR)

Safe to cache at build-time, can revalidate every 24h or per tag

Sigurno se pohranjuje tijekom izgradnje, može se ponovno validirati svakih 24 sata ili po oznaki

Svijet

StockStatusBanner

RSC + prijenos

Frequently changing, streamed in with Suspense to not block TTFB

SvijetSvijet

StockStatusBanner

StockStatusBanner

RSC + prijenos

RSC + streaming

Frequently changing, streamed in with Suspense to not block TTFB

Frequently changing, streamed in with Suspense to not block TTFB

Each component is doing just what it needs to do — no more, no less. No full-page hydration, no global data fetching, no unnecessary JavaScript.

📐 Design Best Practices for Combining Strategies

✅ 1. početak Server-First

Design every component as a Server Component by default. Opt into interactivity ("use client") only when necessary. This keeps bundles smaller and simplifies testing.

✅ 2. Keep boundaries clear

Use folder naming or filename suffixes to make boundaries explicit:

/components
  /server/ProductDetails.tsx
  /client/AddToCartButton.tsx
  /shared/ReviewStars.tsx

✅ 3. Embrace Suspense for progressive delivery

Koristiti<Suspense> to stream in non-critical RSCs without blocking the whole page:

<Suspense fallback={<LoadingReviews />}>
  <ReviewList />
</Suspense>

✅ 4. Co-locate logic with components

Don’t split data-fetching and UI across files unless necessary. In RSC, you can colocate async logic directly inside the component tree — the framework takes care of the rest.

ISR (Incremental Static Regeneration) – povećana statička regeneracija

Za stranice s visokim prometom, kao što su članci na blogu ili marketinški odjeljci, koristite SSG + ponovnu validaciju:

export const revalidate = 3600  // regenerate every hour

⚠️ Common Mistakes to Avoid

  • Using "use client" by default — you’ll end up with CSR all over again
  • Fetching data in client components when it could be server-fetched
  • Passing too much data between RSC and client components via props — instead, let client components be focused, isolated, and stateful
  • Svijet
  • Recreating SSR-style getServerSideProps logic inside RSC — no need, RSC is server-side

✅ Odluka drvo sažetak

Here’s a simplified guide:

Is it interactive?
│
├── Yes → Client Component (CSR)
│
└── No
    │
    ├── Needs per-request data? → SSR
    │
    ├── Can be pre-rendered? → SSG
    │
    └── Otherwise → RSC


Nakon što internalizirate kako prikazivati karte na odgovornost,the decisions become intuitive. u


Najbolja praksa nije odabrati "najbolju strategiju prikazivanja".


Riječ je odesigning rendering as an intentional part of your component architecture — with clarity, purpose, and performance in mind.

6. Looking Ahead: Why RSC Is More Than Just a Feature

6. Looking Ahead: Why RSC Is More Than Just a Feature

React Server komponente nisu samo optimizacija performansi ili poboljšanje DX-athey represent a foundational shift in how we build React applications. Much like React Hooks in 2019, RSC in 2025 is redefining the baseline for frontend architecture. u

RSC mijenja mentalni model izgradnje u reakciji

Tradicionalni React razvoj je uvijek bio izgrađen na ovoj pretpostavci:


“The browser owns the runtime. We hydrate everything. Every piece of logic and data must live in the client, or be fetched via API.”


RSC breaks that assumption.


With RSC, you now ask:

  • Mogu li u potpunosti preskočiti hidrataciju?
  • Can this component run purely on the server?
  • Svijet
  • Can I colocate backend logic with my UI?


Ona nam vraćathe ability to separate display logic and interactivity cleanly, not with wrappers and workarounds, but with first-class architectural boundaries.


It’s no longer “client-first.” It’s “purpose-first.”


Svaki dio vašeg korisničkog interfejsa postoji tamo gdje je najučinkovitiji - server, klijent ili statički.

🌐 Ecosystem Shift Toward Server-First Rendering

RSC isn’t happening in isolation. The broader frontend ecosystem is undergoing a server-first rendering renaissance.


Frameworks like:

  • Remix lean heavily into server data loading and form actions.
  • Astro privremeno prihvaća zero-JS, isporučujući samo otoke interaktivnosti.
  • Qwik takes hydration to the extreme — deferring all JS until explicitly needed.
  • Svijet
  • Next.js 15, with RSC and App Router, now puts per-component rendering at the center of the developer experience.


This isn’t a coincidence. It’s a reflection of a hard truth we’ve all felt:


Sending less JavaScript is the only way to scale interactivity and performance on the modern web.


React Server Components are the React-native answer to that challenge — deeply integrated, ergonomic, and production-ready.

🔮 What to Expect Next

The evolution is still ongoing. As React 19 and the ecosystem mature, we can expect:

    Svijet
  • More granular debugging and profiling tools for RSC trees
  • Better DevTools integration to show boundaries and hydration timelines
  • Vrste višeg reda do strategije abstraktnog prikazivanja (npr. obloge <ServerOnly>, <DeferredClient>)
  • Broader adoption in design systems, frameworks, and libraries (e.g., RSC-aware UI kits)

💬 Enjoyed the read?

Ako vam je ovaj članak pomogao drugačije razmišljati o React i Next.js


👉 Follow me on HackerNoon for more deep dives

Hakeri

👉 Or connect with me on LinkedInrazgovarati o React, arhitekturi ili migraciji RSC-a

LinkedIn
L O A D I N G
. . . comments & more!

About Author

Gianna Song HackerNoon profile picture
Gianna Song@gianna
Don’t take the realities of the world for granted :)

VIJESI OZNAKE

OVAJ ČLANAK JE PREDSTAVLJEN U...

Trending Topics

blockchaincryptocurrencyhackernoon-top-storyprogrammingsoftware-developmenttechnologystartuphackernoon-booksBitcoinbooks