SlideShare a Scribd company logo
Concurrent Rendering
Adventures in React 18
 Maurice de Beijer
 The Problem Solver
 Microsoft MVP
 Freelance developer/instructor
 Twitter: @mauricedb
 Web: http://www.TheProblemSolver.nl
 E-mail: maurice.de.beijer@gmail.com
2
ABL - The Problem Solver
The React
Newsletter
© ABL - The Problem Solver 3
Workshop goal
 Learn about using <Suspense /> today
 Lazy loading of data
 Nest and/or parallelize <Suspense /> components as needed
 Error handling while suspended with an <ErrorBoundary />
 Learn about using concurrent mode tomorrow
 Using createRoot() to render a React 18 application
 The what and how of React concurrent mode
 Orchestrating <Suspense /> boundaries using <SuspenseList />
 Using startTransition() and/or useTransition() to defer work
Type it out
by hand?
“Typing it drills it into your brain much better than
simply copying and pasting it.You're forming new
neuron pathways.Those pathways are going to
help you in the future. Help them out now!”
© ABL - The Problem Solver 5
Prerequisites
Install Node & NPM
Install the GitHub repository
© ABL - The Problem Solver 6
Install
Node.js & NPM
© ABL - The Problem Solver 7
Clone the
GitHub
Repository
© ABL - The Problem Solver 8
Install NPM
Packages
© ABL - The Problem Solver 9
Following
Along
 Repository:
https://github.com/mauricedb/concurrent-rendering-adventures-in-react-18
 Slides:
http://www.theproblemsolver.nl/workshop-concurrent-rendering-adventures-in-react-18.pdf
© ABL - The Problem Solver 10
React 17
Photo by VisualTag Mx on Pexels
<Suspense />
<Suspense />
 Allows React to “suspend” rendering a component subtree
 Used when a (grand) child component is not ready to be rendered
 ECMAScript bundle containing the component isn’t loaded yet
 The data needed for a component to render isn’t available yet
 The “fallback” component will be rendered instead
 Replaces the complete children component tree
 Rendering is suspended when a promise is thrown
 And resumed when the promise resolves
SWR and
Suspense
 SWR is used in the application to load data
 A convenient hook to fetch data
 SWR makes it easy to start using suspense
 Add suspense: true to the <SWRConfig />
index.tsx
UserList.tsx
AccountDetails.tsx
MovieDetails.tsx
The Result
<Suspense /> & Errors
<Suspense />
& Errors
 If a suspense resource fails to load an error is thrown
 When requesting it during the render()
 Catch the error using an ErrorBoundary
 Just like other runtime errors in React lifecycle functions
 Error boundaries can be nested
 Just like suspense boundaries
index.tsx
The Result
UserDetails.tsx
The Result
Nesting <Suspense />
Nesting
<Suspense />
 Multiple suspense components can be nested
 React will use the closest parent <Suspense /> component
 Very useful to control what part of the UI is replaced by a fallback
 👉There is a behavior change in React 18 with null fallback 👈
App.tsx
The Result
MovieDetails.tsx
The Result
Parallel <Suspense />
Parallel
<Suspense />
 Multiple suspense boundaries can suspend in parallel
 React will suspend them all and show multiple fallback components
 If you want to render a component while others are still loading
 Multiple suspending components in a single <Suspense/> is also
fine
 Will resume when all resource promises are resolved
MovieDetails.tsx
The Result
Break time
Photo by Mindspace Studio on Unsplash
React 18
Photo by cottonbro on Pexels
React 18
 React 18 is still in alpha/preview version right now
 Daily publish to NPM using the @next and the @alpha tags
 npm install react@next react-dom@next --force
package.json
index.tsx
New hooks
New hooks
 useDeferredValue()
 Returns a deferred version of the value that may lag behind
 useTransition()
 Avoid undesirable states when waiting for content
 useMutableSource()
 Enables React components to safely and efficiently read from a
mutable external source in Concurrent Mode
 Avoids tearing
 useOpaqueIdentifier()
 Can be used to generate unique ID’s in an SSR-safe way
useOpaqueIdentifier()
useOpaqueIdentifier()
 Can be used to generate unique ID’s in a SSR-safe way
 👉 Still prefixed with unstable_ 👈
 👉Will be renamed to useId() in React 18! 👈
LabelInput.tsx
The Result
Using <SuspenseList />
Orchestrating <Suspense /> boundaries
Using
<SuspenseList />
 <SuspenseList /> will let you control how multiple <Suspense />
components render their fallback
 The order in which child components show when ready
 If multiple child fallbacks components are displayed
UserDetails.tsx
The Result
Concurrent Mode
React 17
rendering
components
User click
event
Event running
React 18
Concurrent
mode
Event running
with
concurrent
mode
Using startTransition()
To defer lower priority work
Using
startTransition()
 Code in a startTransition() callback is considered low
priority
 Can be interrupted by more urgent updates
 Like user events
PrimeNumbers.tsx
The Result
Using useTransition()
To defer lower priority work and know about pending updates
Using
useTransition()
 The useTransition() hook can be used to control how React
renders when components suspend
 Prevent the fallback component being rendered immediately
 The new components will be rendered when:
 Their resources are ready
 The timeout is expired
 The “old” UI can use the isPending state when rendering
PrimeNumbers.tsx
The Result
startTransition()
vs
useTransition()
startTransition()
 Can be used anywhere
 No additional renders
useTransition()
 Needs to be used in a
functional component
 One additional render with
isPending
UI state transitions
with useTransition()
More control over how UI state updates are done
UserList.tsx (1/2)
UserList.tsx (2/2)
UserDetails.tsx
The Result
Conclusion
 You can use <Suspense /> today
 Suspend when lazily loading components and/or fetching data
 Handle error with an <ErrorBoundary />
 Nest and/or parallelize as needed
 Concurrent mode
 Coming soon to a React application near you
 Can make large applications more responsive
 Render a React 18 application using createRoot()
 Use <SuspenseList /> to orchestrate <Suspense /> components
 Defer work with startTransition() and/or useTransition()
Maurice de Beijer
@mauricedb
maurice.de.beijer
@gmail.com
© ABL - The Problem Solver 72

More Related Content

PPTX
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
PPTX
Feature flag launchdarkly
PDF
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
PPTX
Spring Webflux
PPTX
Its time to React.js
PDF
Kafka At Scale in the Cloud
PDF
The virtual DOM and how react uses it internally
PDF
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Feature flag launchdarkly
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
Spring Webflux
Its time to React.js
Kafka At Scale in the Cloud
The virtual DOM and how react uses it internally
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview

What's hot (20)

PDF
Spring Boot Interview Questions | Edureka
PDF
[Webinar]: Working with Reactive Spring
PDF
Desmistificando a programação reativa
PDF
Devoxx France 2023 - Les nouveautés de Java 19 et 20
PPTX
React js - The Core Concepts
PDF
React Interview Questions and Answers | React Tutorial | React Redux Online T...
PPTX
ReactJs
PPTX
Getting Started with Azure DevOps
PDF
Introduction to React Native
PPTX
React workshop
PDF
React js
PDF
Simple React Todo List
PPTX
react-slides.pptx
PPTX
reactJS
PDF
React Native
PPT
ASP.NET MVC Presentation
 
PPTX
Grafana Loki (Monitoring Tool) Presentation
PPTX
Axon Framework, Exploring CQRS and Event Sourcing Architecture
PPTX
Introduction Ă  ajax
PPSX
Elastic-Engineering
Spring Boot Interview Questions | Edureka
[Webinar]: Working with Reactive Spring
Desmistificando a programação reativa
Devoxx France 2023 - Les nouveautés de Java 19 et 20
React js - The Core Concepts
React Interview Questions and Answers | React Tutorial | React Redux Online T...
ReactJs
Getting Started with Azure DevOps
Introduction to React Native
React workshop
React js
Simple React Todo List
react-slides.pptx
reactJS
React Native
ASP.NET MVC Presentation
 
Grafana Loki (Monitoring Tool) Presentation
Axon Framework, Exploring CQRS and Event Sourcing Architecture
Introduction Ă  ajax
Elastic-Engineering
Ad

Similar to Concurrent Rendering Adventures in React 18 (20)

PPTX
Getting started with React Suspense and concurrent rendering
PDF
RxJava@Android
DOCX
Asynchronyin net
PDF
Concurrecny inf sharp
PDF
DZone_RC_RxJS
PDF
Android development training programme , Day 3
PPTX
Intro react js
PDF
Murach : How to work with session state and cookies
PDF
MeetJS Summit 2016: React.js enlightenment
PDF
Declarative presentations UIKonf
PPTX
Let's react - Meetup
DOCX
Introduction To Programming IP5
PPTX
NET_Training.pptx
PDF
Android Best Practices - Thoughts from the Trenches
PPTX
Adding a modern twist to legacy web applications
PPTX
Promises, promises, and then observables
PPTX
Training – Going Async
PPTX
ĐĐœĐŽŃ€Ń–Đč Đ Đ”ĐČа, "How to build reactive java application"
PPTX
Reactive programming with rx java
PPTX
27 - Panorama Necto 14 component mode & java script - visualization & data di...
Getting started with React Suspense and concurrent rendering
RxJava@Android
Asynchronyin net
Concurrecny inf sharp
DZone_RC_RxJS
Android development training programme , Day 3
Intro react js
Murach : How to work with session state and cookies
MeetJS Summit 2016: React.js enlightenment
Declarative presentations UIKonf
Let's react - Meetup
Introduction To Programming IP5
NET_Training.pptx
Android Best Practices - Thoughts from the Trenches
Adding a modern twist to legacy web applications
Promises, promises, and then observables
Training – Going Async
ĐĐœĐŽŃ€Ń–Đč Đ Đ”ĐČа, "How to build reactive java application"
Reactive programming with rx java
27 - Panorama Necto 14 component mode & java script - visualization & data di...
Ad

More from Maurice De Beijer [MVP] (20)

PPTX
Full-stack App in half a Day: Next.js 15 Development Bootcamp
PPTX
Production-ready Next.js App with Cursor AI
PPTX
Building Robust Web Applications with Test-Driven Development and Playwright:...
PDF
Mastering React Server Components and Server Actions in React 19
PPTX
Practice TypeScript Techniques Building React Server Components App
PPTX
A foolproof Way to Estimate a Software Project
PPTX
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
PPTX
Build reliable Svelte applications using Cypress
PPTX
Building Reliable Applications Using React, .NET & Azure
PPTX
Building reliable applications with React, C#, and Azure
PPTX
Building large and scalable mission critical applications with React
PPTX
Building Reliable Applications Using React, .NET & Azure
PPTX
Why I am hooked on the future of React
PPTX
Building reliable web applications using Cypress
PPTX
React suspense, not just for Alfred Hitchcock
PPTX
From zero to hero with the Reactive extensions for JavaScript
PPTX
Why I am hooked on the future of React
PPTX
The new React
PPTX
From zero to hero with the reactive extensions for JavaScript
PPTX
Why I am hooked on the future of React
Full-stack App in half a Day: Next.js 15 Development Bootcamp
Production-ready Next.js App with Cursor AI
Building Robust Web Applications with Test-Driven Development and Playwright:...
Mastering React Server Components and Server Actions in React 19
Practice TypeScript Techniques Building React Server Components App
A foolproof Way to Estimate a Software Project
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
Build reliable Svelte applications using Cypress
Building Reliable Applications Using React, .NET & Azure
Building reliable applications with React, C#, and Azure
Building large and scalable mission critical applications with React
Building Reliable Applications Using React, .NET & Azure
Why I am hooked on the future of React
Building reliable web applications using Cypress
React suspense, not just for Alfred Hitchcock
From zero to hero with the Reactive extensions for JavaScript
Why I am hooked on the future of React
The new React
From zero to hero with the reactive extensions for JavaScript
Why I am hooked on the future of React

Recently uploaded (20)

PDF
System and Network Administration Chapter 2
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Transform Your Business with a Software ERP System
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
history of c programming in notes for students .pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
System and Network Administration Chapter 2
iTop VPN Free 5.6.0.5262 Crack latest version 2025
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
Transform Your Business with a Software ERP System
Digital Systems & Binary Numbers (comprehensive )
Upgrade and Innovation Strategies for SAP ERP Customers
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PTS Company Brochure 2025 (1).pdf.......
wealthsignaloriginal-com-DS-text-... (1).pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
history of c programming in notes for students .pptx
Design an Analysis of Algorithms II-SECS-1021-03

Concurrent Rendering Adventures in React 18

Editor's Notes

  • #11: Time: 5:00
  • #12: Foto door Visual Tag Mx via Pexels
  • #20: Time: 8:00
  • #26: Time: 5:00
  • #32: Time: 5:00
  • #36: Time: 5:00
  • #37: Photo by Mindspace Studio on Unsplash
  • #38: Foto door cottonbro via Pexels
  • #41: Time: 5:00
  • #47: Time: 5:00
  • #51: Time: 5:00
  • #61: Time: 5:00
  • #65: Time: 5:00
  • #71: Time: 5:00