SlideShare a Scribd company logo
1 of 12
Download to read offline
Concurrent React
wednesday.is
Presented by:Aditya Doshi
2
Content
What we’ll be covering
What exactly react concurrent mode is
How it works behind the scenes
Code Examples
React new features, apis to run concurrent mode
3
Concurrent Mode
The what and the why?
Concurrent mode is a set of new features that help React app stay responsive and
gracefully adjust to the user’s device capabilities and network speed.
Concurrent react can work on multiple tasks at a time, and switch between them
according to priority.
4
Use cases
Concurrent react can partially render a tree without committing the result
Example
React can start rendering an update & if it hit’s a component that hasn’t finished loading for
instance, react can wait for it to complete before it continues & it doesn’t immediately has
to show a fallback or a spinner.
5
Thread
The what and the why?
Concurrent react does not block the main thread.
So today when react updates a component, it’s going to do all of the work in a single
uninterruptible block on the main thread.
User events fire in the main thread, so the issue is, when react is rendering an update & in
the meantime user tries to type into the input, it would not be able to process until the re-
render is completed.
But in concurrent react, it’s going to pause the current render, it’s going to switch to
complete the user blocking task & then resume afterwards on the original rendering part.
Also referred to time slicing - ability to split work into chunks and spread it’s execution of
time.
6
Comparing with code splitting
Code splitting usage & a limitation
Usage: Instead of sending all of the code for the initial payload, we send down what’s
needed for the first screen & we defer the rest to later, maybe with lazy loading, navigation.
Limitation: If the view hasn’t finished loading, what do you display to the user? Maybe a
spinner, placeholder.
7
Concurrent react is not blocking
You can render large amount of work without blocking user inputs or other high priority
tasks on the main thread.
8
startTransitionAPI
Lets you mark updates inside the provided callback as transitions.
Updates in a transition will not show a fallback for re-suspended content, allowing the user
to continue interacting while rendering the update.
wednesday.is
useTransition hook
useTransition hook provides access to two variables - startTransition &
isPending
It is a function which will tell react which render are less important, isPending is a boolean that
tells us weather our list is pending to be rendered or not
10
Suspense for data fetching
It allows to show a placeholder while waiting for a code split part of our application.
Asimilar way to work as transition but here it works anything using promises.
To work with suspense, we need to wrap promises with a function wrapPromise which
returns different values based on what suspense is expecting on each step of the process.
11
Key Takeaways
What we learned
How concurrent mode works
Thread execution
Code splitting
Code examples
Thank you
for your time
wednesday.is

More Related Content

Similar to What is React Concurrent Mode: A Walkthrough

The complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrThe complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrAfreenK
 
Reactive programming with rx java
Reactive programming with rx javaReactive programming with rx java
Reactive programming with rx javaCongTrung Vnit
 
Everything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideEverything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideBOSC Tech Labs
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppKaty Slemon
 
Android Dagger 2
Android  Dagger 2Android  Dagger 2
Android Dagger 2Sanket Shah
 
Easy job scheduling with android
Easy job scheduling with androidEasy job scheduling with android
Easy job scheduling with androidkirubhakarans2
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react jsStephieJohn
 
Андрій Рева, "How to build reactive java application"
Андрій Рева, "How to build reactive java application"Андрій Рева, "How to build reactive java application"
Андрій Рева, "How to build reactive java application"Sigma Software
 
How can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfHow can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfMindfire LLC
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?BOSC Tech Labs
 
Introduction to dependency injection in Scala (Play)
Introduction to dependency injection in Scala (Play)Introduction to dependency injection in Scala (Play)
Introduction to dependency injection in Scala (Play)Knoldus Inc.
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malikLama K Banna
 
reactjs interview questions.pdf
reactjs interview questions.pdfreactjs interview questions.pdf
reactjs interview questions.pdfrohityadav23214
 
10 Ways to Boost the Performance of React Native Apps.pdf
10 Ways to Boost the Performance of React Native Apps.pdf10 Ways to Boost the Performance of React Native Apps.pdf
10 Ways to Boost the Performance of React Native Apps.pdfExpert App Devs
 
If the Android platform you are developing for does not support fragme.docx
If the Android platform you are developing for does not support fragme.docxIf the Android platform you are developing for does not support fragme.docx
If the Android platform you are developing for does not support fragme.docxedwardk6
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
 
Understanding of react fiber architecture
Understanding of react fiber architectureUnderstanding of react fiber architecture
Understanding of react fiber architectureInnovationM
 

Similar to What is React Concurrent Mode: A Walkthrough (20)

The complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrThe complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrr
 
Reactive programming with rx java
Reactive programming with rx javaReactive programming with rx java
Reactive programming with rx java
 
Everything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideEverything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive Guide
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
Top 5 React Performance Optimization Techniques in 2023
Top 5 React Performance Optimization Techniques in 2023Top 5 React Performance Optimization Techniques in 2023
Top 5 React Performance Optimization Techniques in 2023
 
Android Dagger 2
Android  Dagger 2Android  Dagger 2
Android Dagger 2
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
Easy job scheduling with android
Easy job scheduling with androidEasy job scheduling with android
Easy job scheduling with android
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Андрій Рева, "How to build reactive java application"
Андрій Рева, "How to build reactive java application"Андрій Рева, "How to build reactive java application"
Андрій Рева, "How to build reactive java application"
 
How can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfHow can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdf
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?
 
Introduction to dependency injection in Scala (Play)
Introduction to dependency injection in Scala (Play)Introduction to dependency injection in Scala (Play)
Introduction to dependency injection in Scala (Play)
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
 
reactjs interview questions.pdf
reactjs interview questions.pdfreactjs interview questions.pdf
reactjs interview questions.pdf
 
10 Ways to Boost the Performance of React Native Apps.pdf
10 Ways to Boost the Performance of React Native Apps.pdf10 Ways to Boost the Performance of React Native Apps.pdf
10 Ways to Boost the Performance of React Native Apps.pdf
 
If the Android platform you are developing for does not support fragme.docx
If the Android platform you are developing for does not support fragme.docxIf the Android platform you are developing for does not support fragme.docx
If the Android platform you are developing for does not support fragme.docx
 
Java 10 - Key Note
Java 10 - Key NoteJava 10 - Key Note
Java 10 - Key Note
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
 
Understanding of react fiber architecture
Understanding of react fiber architectureUnderstanding of react fiber architecture
Understanding of react fiber architecture
 

More from Wednesday Solutions

Master iOS Performance Optimization with Instruments
Master iOS Performance Optimization with InstrumentsMaster iOS Performance Optimization with Instruments
Master iOS Performance Optimization with InstrumentsWednesday Solutions
 
Memory Management in Go: Stack, Heap & Garbage Collector
Memory Management in Go: Stack, Heap & Garbage CollectorMemory Management in Go: Stack, Heap & Garbage Collector
Memory Management in Go: Stack, Heap & Garbage CollectorWednesday Solutions
 
Create Basic 3D Scenes Using Three.js
Create Basic 3D Scenes Using Three.jsCreate Basic 3D Scenes Using Three.js
Create Basic 3D Scenes Using Three.jsWednesday Solutions
 
What is Temporal: Workflow & Cluster
What is Temporal: Workflow & ClusterWhat is Temporal: Workflow & Cluster
What is Temporal: Workflow & ClusterWednesday Solutions
 

More from Wednesday Solutions (8)

Error Handling in Express
Error Handling in ExpressError Handling in Express
Error Handling in Express
 
Master iOS Performance Optimization with Instruments
Master iOS Performance Optimization with InstrumentsMaster iOS Performance Optimization with Instruments
Master iOS Performance Optimization with Instruments
 
Memory Management in Go: Stack, Heap & Garbage Collector
Memory Management in Go: Stack, Heap & Garbage CollectorMemory Management in Go: Stack, Heap & Garbage Collector
Memory Management in Go: Stack, Heap & Garbage Collector
 
Create Basic 3D Scenes Using Three.js
Create Basic 3D Scenes Using Three.jsCreate Basic 3D Scenes Using Three.js
Create Basic 3D Scenes Using Three.js
 
A Guide to Figma for Developers
A Guide to Figma for DevelopersA Guide to Figma for Developers
A Guide to Figma for Developers
 
What is Temporal: Workflow & Cluster
What is Temporal: Workflow & ClusterWhat is Temporal: Workflow & Cluster
What is Temporal: Workflow & Cluster
 
Vector Embedding using AI
Vector Embedding using AIVector Embedding using AI
Vector Embedding using AI
 
What is GraphQL: Best Practices
What is GraphQL: Best PracticesWhat is GraphQL: Best Practices
What is GraphQL: Best Practices
 

Recently uploaded

Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 

Recently uploaded (20)

Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

What is React Concurrent Mode: A Walkthrough

  • 2. 2 Content What we’ll be covering What exactly react concurrent mode is How it works behind the scenes Code Examples React new features, apis to run concurrent mode
  • 3. 3 Concurrent Mode The what and the why? Concurrent mode is a set of new features that help React app stay responsive and gracefully adjust to the user’s device capabilities and network speed. Concurrent react can work on multiple tasks at a time, and switch between them according to priority.
  • 4. 4 Use cases Concurrent react can partially render a tree without committing the result Example React can start rendering an update & if it hit’s a component that hasn’t finished loading for instance, react can wait for it to complete before it continues & it doesn’t immediately has to show a fallback or a spinner.
  • 5. 5 Thread The what and the why? Concurrent react does not block the main thread. So today when react updates a component, it’s going to do all of the work in a single uninterruptible block on the main thread. User events fire in the main thread, so the issue is, when react is rendering an update & in the meantime user tries to type into the input, it would not be able to process until the re- render is completed. But in concurrent react, it’s going to pause the current render, it’s going to switch to complete the user blocking task & then resume afterwards on the original rendering part. Also referred to time slicing - ability to split work into chunks and spread it’s execution of time.
  • 6. 6 Comparing with code splitting Code splitting usage & a limitation Usage: Instead of sending all of the code for the initial payload, we send down what’s needed for the first screen & we defer the rest to later, maybe with lazy loading, navigation. Limitation: If the view hasn’t finished loading, what do you display to the user? Maybe a spinner, placeholder.
  • 7. 7 Concurrent react is not blocking You can render large amount of work without blocking user inputs or other high priority tasks on the main thread.
  • 8. 8 startTransitionAPI Lets you mark updates inside the provided callback as transitions. Updates in a transition will not show a fallback for re-suspended content, allowing the user to continue interacting while rendering the update.
  • 9. wednesday.is useTransition hook useTransition hook provides access to two variables - startTransition & isPending It is a function which will tell react which render are less important, isPending is a boolean that tells us weather our list is pending to be rendered or not
  • 10. 10 Suspense for data fetching It allows to show a placeholder while waiting for a code split part of our application. Asimilar way to work as transition but here it works anything using promises. To work with suspense, we need to wrap promises with a function wrapPromise which returns different values based on what suspense is expecting on each step of the process.
  • 11. 11 Key Takeaways What we learned How concurrent mode works Thread execution Code splitting Code examples
  • 12. Thank you for your time wednesday.is