SlideShare a Scribd company logo
2
Most read
5
Most read
10
Most read
JogjaJS / 28 October 2023
React Server
Components
in Next.js
• Senior Software Engineer / Tech
Lead Frontend @
• Currently helping Jakpat
migrating internal dashboard
from (Laravel + AngularJS) to
(React + Next.js)
Hanief Utama
Once upon a time…
• HTML ( 30 years ago )
• PHP ( 28 years ago )
• Javascript ( 27 years ago )
• CSS ( 26 years ago )
• React ( 10 years ago )
First Web Server By Coolcaesar at the English-language Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=395096
React Server Component in Next.js by Hanief Utama
Client
Server
0 10 20 30
Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/]
Client Side
Rendering
Download
Javascript
Render Shell Render Content
Database
Query
First Paint
Content
Painted
Page Interactive
The OG React way
Server Side
Rendering
Client
Server
0 10 20 30
Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/]
Download
Javascript
Render
Shell
Render Content
Database
Query
Hydrate
First
Paint
Page
Interactive
Content
Painted
Same as CSR but better SEO
Why not this?
Client
Server
0 10 20 30
Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/]
Download
Javascript
Render
App
Database
Query
Hydrate
First Paint
Content Painted Page Interactive
Some frameworks already have
this
React Server Components
Server Component Client Component
Server Component Client Component
Render only on server Render on server and client
New kind of component The component that we already know
Default component ‘use client’;
No state Can use state
Can import Client Component Can ONLY import Client Component
App
Header Article
HitCounter Discussion
Comment Comment
App
Header
‘Use client’;
Article
HitCounter Discussion
Comment Comment
App
Header
‘Use client’;
Article
HitCounter Discussion
Comment Comment
Client Boundary
Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/]
React Server Component in Next.js by Hanief Utama
Next.js is the only
framework that o
ff
er full
support of RSC
Using Server Components in Next.js
• Next.js 13.4+
• Use App Router
• Server Components is default
Pros?
• Smaller bundle size
• Faster rendering
• Server is controllable vs di
ff
erent
kind of browser
• Hydrate only what is needed
• Keep sensitive data on the server
• Caching
Cons?
• No CSS-in-JS
• React Context doesn’t work
• More things to think about
• More work on server
• Need to control which part hydrate
Should I use React Server Components?
• Yes, if you are already deeply invested in React + Next.js
• Yes, if you have control of the server
• Yes, if performance is very important to you
• Yes, if your bundle size is too big
• No, if your life is complex enough already
Adoption strategy
• Add the “use client” directive to the root of your app
• Move the directive as low in the rendering tree as you can
• Adopt advanced patterns when performance issues arise
Thank you

More Related Content

Similar to React Server Component in Next.js by Hanief Utama (20)

PPTX
Server side rendering review
Vladyslav Morzhanov
 
PDF
Server-side React with Headless CMS – Exove
Exove
 
PPTX
Introduction to React.js and Next.js.pptx
alpeshconnect1
 
PDF
Breaking the Server-Client Divide with Node.js and React
Dejan Glozic
 
PDF
NextJS - Online Summit for Frontend Developers September 2020
Milad Heydari
 
PDF
nextjs-handbook.pdf
RaviKumar76265
 
PPTX
Next JS vs React.pptx
Albiorix Technology
 
PPTX
How to React to JavaScript Insecurity
Ksenia Peguero
 
PDF
Next.js with drupal, the good parts
Taller Negócio Digitais
 
PPTX
React JS Vs Next JS - What's The Difference | Next JS Tutorial For Beginners ...
Simplilearn
 
PDF
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
PPTX
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
 
PDF
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
Semiosis Software Private Limited
 
PDF
Server side rendering with React and Symfony
Ignacio Martín
 
PPTX
What Is Next JS ? | Introduction to Next JS | Basics of Next JS | Next JS Tut...
Simplilearn
 
PPTX
Building isomorphic java script apps faster with next.js
Madhav Chaturvedi
 
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
PPTX
difference between React and Next js
umairfarooq73
 
PDF
Next.js Development: The Ultimate Solution for High-Performance Web Apps
rwinfotech31
 
PDF
Tech Talk on ReactJS
Atlogys Technical Consulting
 
Server side rendering review
Vladyslav Morzhanov
 
Server-side React with Headless CMS – Exove
Exove
 
Introduction to React.js and Next.js.pptx
alpeshconnect1
 
Breaking the Server-Client Divide with Node.js and React
Dejan Glozic
 
NextJS - Online Summit for Frontend Developers September 2020
Milad Heydari
 
nextjs-handbook.pdf
RaviKumar76265
 
Next JS vs React.pptx
Albiorix Technology
 
How to React to JavaScript Insecurity
Ksenia Peguero
 
Next.js with drupal, the good parts
Taller Negócio Digitais
 
React JS Vs Next JS - What's The Difference | Next JS Tutorial For Beginners ...
Simplilearn
 
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
 
React vs Next js: Which is Better for Web Development? - Semiosis Software Pr...
Semiosis Software Private Limited
 
Server side rendering with React and Symfony
Ignacio Martín
 
What Is Next JS ? | Introduction to Next JS | Basics of Next JS | Next JS Tut...
Simplilearn
 
Building isomorphic java script apps faster with next.js
Madhav Chaturvedi
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
difference between React and Next js
umairfarooq73
 
Next.js Development: The Ultimate Solution for High-Performance Web Apps
rwinfotech31
 
Tech Talk on ReactJS
Atlogys Technical Consulting
 

Recently uploaded (20)

PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Ad

React Server Component in Next.js by Hanief Utama

  • 1. JogjaJS / 28 October 2023 React Server Components in Next.js
  • 2. • Senior Software Engineer / Tech Lead Frontend @ • Currently helping Jakpat migrating internal dashboard from (Laravel + AngularJS) to (React + Next.js) Hanief Utama
  • 3. Once upon a time… • HTML ( 30 years ago ) • PHP ( 28 years ago ) • Javascript ( 27 years ago ) • CSS ( 26 years ago ) • React ( 10 years ago ) First Web Server By Coolcaesar at the English-language Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=395096
  • 5. Client Server 0 10 20 30 Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/] Client Side Rendering Download Javascript Render Shell Render Content Database Query First Paint Content Painted Page Interactive The OG React way
  • 6. Server Side Rendering Client Server 0 10 20 30 Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/] Download Javascript Render Shell Render Content Database Query Hydrate First Paint Page Interactive Content Painted Same as CSR but better SEO
  • 7. Why not this? Client Server 0 10 20 30 Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/] Download Javascript Render App Database Query Hydrate First Paint Content Painted Page Interactive Some frameworks already have this
  • 10. Server Component Client Component Render only on server Render on server and client New kind of component The component that we already know Default component ‘use client’; No state Can use state Can import Client Component Can ONLY import Client Component
  • 13. App Header ‘Use client’; Article HitCounter Discussion Comment Comment Client Boundary Chart adapted from Josh W Comeau [https://www.joshwcomeau.com/react/server-components/]
  • 15. Next.js is the only framework that o ff er full support of RSC
  • 16. Using Server Components in Next.js • Next.js 13.4+ • Use App Router • Server Components is default
  • 17. Pros? • Smaller bundle size • Faster rendering • Server is controllable vs di ff erent kind of browser • Hydrate only what is needed • Keep sensitive data on the server • Caching Cons? • No CSS-in-JS • React Context doesn’t work • More things to think about • More work on server • Need to control which part hydrate
  • 18. Should I use React Server Components? • Yes, if you are already deeply invested in React + Next.js • Yes, if you have control of the server • Yes, if performance is very important to you • Yes, if your bundle size is too big • No, if your life is complex enough already
  • 19. Adoption strategy • Add the “use client” directive to the root of your app • Move the directive as low in the rendering tree as you can • Adopt advanced patterns when performance issues arise