Web Performance & Latest in
React
o Govind Vijay
o Roopa Rauniyar
Topics
2
Dev tools
Web performance
React tools
3
Theory
Loading time
Rendering time
Web performance
Lighthouse
4
Web performance Loading time (Remove unused code)
5
Web performance Loading time (Remove unused code)
6
Web performance Loading time (Remove unused code)
7
Web performance Loading time (Remove unused code)
8
Web performance Loading time (Remove unused code)
9
Web performance Loading time (Remove unused code)
10
Web performance Loading time (Remove unused code)
11
Web performance Loading time (Remove unused code)
12
Web performance Loading time (Remove unused code)
13
Web performance Loading time (Remove unused code)
14
Web performance Loading time (Remove unused code)
15
Web performance Loading time (Code splitting)
16
Web performance Loading time (Code splitting)
17
Web performance Loading time (Code splitting)
18
Web performance Loading time (Code splitting)
19
Web performance Loading time (Code splitting)
20
Web performance Loading time (Code splitting)
21
Web performance Loading time (Tree shaking)
Keeping Babel from
transpiling ES6
modules to
CommonJS modules
• Tree shaking is
much more
difficult to do for
CommonJS
modules.
Tell webpack about
side effects
Import only what
we need
22
Web performance Loading time (Tree shaking)
23
Web performance Loading time (Tree shaking)
24
Web performance Rendering time
25
Web performance Rendering time
26
Web performance Rendering time
27
Web performance Rendering time
28
Web performance Rendering time
29
Web performance Rendering time (Rasterizing)
30
Web performance Rendering time (Composting)
31
Web performance Rendering time (Composting)
32
Web performance Rendering time (Composting)
If certain parts of a page that should be separate layer (like slide-in side menu) is not getting one,
then you can hint to the browser by using will-change attribute in CSS.
33
Web performance Rendering time
Avoid layout changes wherever possible
Layout is almost always scoped to the entire document. If you have a lot of elements, it’s going
to take a long time to figure out the locations and dimensions of them all.
34
Web performance Rendering time
Avoid forced synchronous layouts
35
Web performance Rendering time
Avoid layout thrashing
36
Web performance Theory
37
Web performance Theory
38
Web performance Theory
Largest Contentful Paint (LCP): measures loading performance.
To provide a good user experience, LCP should occur within 2.5
seconds of when the page first starts loading.
39
Web performance Theory
40
Web performance Theory
41
Web performance Theory
42
Web performance Theory
43
Web performance Theory
44
Web performance Theory
45
Web performance Theory
46
Web performance Theory
47
Web performance Theory
First Input Delay (FID): measures interactivity. To provide a
good user experience, pages should have a FID of 100
milliseconds or less.
48
Web performance Theory
49
Web performance Theory
Cumulative Layout Shift (CLS): measures visual stability. To
provide a good user experience, pages should maintain a CLS of
0.1. or less.
50
Web performance Theory
51
Web performance Theory
52
Dev tools
Debugging
53
Dev tools Debugging
Breakpoints: Conditional, DOM etc.
Live editing
Watch expression
Create a live expression
54
Debugging
React tools
55
React tools Debugging
Latest in React & Best
Practices for performance
optimization
57
Latest in React & Best Practices for
performance optimization
React 17
No new developer-facing features
primarily focused on making it easier to upgrade React itself.
It makes it easier to embed React into apps built with other technologies
It’s possible to use two versions of React on the page
Supports new JSX Transform
58
Old JSX transform
• The old JSX transform turned JSX into React.createElement(...) calls
Source Code
Old JSX Transform
59
New JSX transform
• original code did not need to import React to use JSX
anymore.
• But we would still need to import React in order to use Hooks
or other exports that React provides.
60
Diagrammatical
Difference
React will no longer
attach event handlers
at the document level
under the hood.
Instead, it will attach
them to the root DOM
container into which
your React tree is
rendered
61
React 18
Features The New Root API
startTransition API
Strict Effects coming to Strict Mode
SSR Improvements
Suspense List
useDeferredValue
• Not yet released
• Alpha version Available today
• When it’s released, React 18 will
include out-of-the-box
improvements.
• React 18 supports concurrent
rendering
62
New Root API
63
Current Support
ReactDOM.render(<App/>,document.getElementById('root’));
Upcoming
startTransition API
• This helps in keeping the current webpage responsive and being able to do
heavy non-blocking UI updates at the same time.
• This API provides a way to differentiate between quick updates and
delayed updates. The delayed update(i.e. transition of one UI view to
another) is termed as Transition Updates.
• For urgent updates like typing, hover, clicking, we call props/functions
usually like this :
• For non-urgent or heavy UI updates, we can wrap it in a startTransition API
as :
64
Strict Effects coming to Strict Mode
• React18 will ship <StrictMode /> along with Strict
Effects Mode now. Just like Strict Mode, this would be for
development builds and improved DX.
• When a component is wrapped in Strict Effects, React will
make sure to "intentionally" run side-effects twice to detect
unusual behaviour/pattern
65
SSR Improvements
• SSR had to load the entire page before it can start hydrating
page.
• This changes in React18, now we can break React
components into smaller chunks using <Suspense />.
66
Suspense List
• Another React 18 concurrent feature, which "orchestrates" the order in
which heavy data fetched components appear on the screen.
• A <SuspenseList /> takes in revealOrder prop with values forward,
backward or together
67
useDeferredValue
• useDeferredValue takes in a state value, a timeout in
milliseconds and returns a "deferred version" of that value. This
value lags by the provided timeout seconds.
68
Code Snippet
69
React Best Practices for performance
Optimization
• Use React Pure Components to reduce Re-rendering
• Use React.memo for Component Memorization
• Using Lazy Loading of React Components
• Throttling Events
• Debouncing Events
• Virtualization
70
Pure Components
• Re-rendering can be reduced using Pure
components
• PureComponents take care
of shouldComponentUpdate— it does the shallow
comparison on the state and props data.
• It compares previous props and state to the next
and if not equal then only re-renders.
• Comparing primitive and object references is a
cheaper operation than updating the component
view.
71
Code Snippet
72
React.memo
• React.memo is a higher-order component.
• It is similar to a PureComponent,
but PureComponent belongs to the class
implementation for Component, whereas “memo”
is used for the creation of functional components.
• It memorizes the output from the last execution
for a certain input prop and boosts the
application performance.
73
Code Snippet
74
Lazy Loading
All the main components and the external
dependencies are merged into a single file and sent
over the network to have the web application up and
running.
This saves a lot of network calls, but also leads to a
problem where this single file becomes a large file
and consumes lots of network bandwidth.
The application keeps waiting for this large file to be
loaded and executed, so delays in transmission of this
file over the network lead to higher rendering time
for the application.
75
Resolution using Lazy Loading
• To resolve this problem, we can incorporate the
concept of code splitting.
• Webpack supports code splitting.
• Loading on runtime reduces the size of the initial
bundle.
• Suspense and lazy used for supporting this
concept.
76
Code Snippet (Example 1)
77
Code Snippet (Example 2)
78
Throttling Events
Throttling means delaying function execution.
It ensures that the function will be called at least once in a
specific time period. It means that it will prevent a function from
running if it has run recently. It ensures that the function runs
regularly in fixed intervals.
79
When to use Throttling ?
• In the case of page scrolling, instead of triggering
the scroll event too frequently, we delay the event
for some time so that multiple events can be
stacked together.
• When we have infinite scroll and the data has to
be fetched as the user approaches the bottom of
the page, we can use throttling.
• If throttling is not used, each page scroll towards
the bottom of the page will trigger multiple
events, and multiple calls to the network are
triggered, leading to performance concerns.
80
Debouncing Concepts
• Debouncing refers to ignoring the event handler
call until the calls have stopped for a certain
amount of time.
• Let's imagine that we have an event with
a debounce time of one second. The event
handler for that event will be triggered after one
second, once the user stops triggering the event.
81
Supporting Library
• We can use third-party libraries to implement and
use the throttling and debouncing features. One
such library is throttle-debounce.
82
Virtualization
• When we have large list to render it overload the DOM
and performance hampers.
• To overcome this issue virtualization came into picture.
• “virtualized list” meaning that only the visible rows are
rendered.
• This will increase the performance in a way that DOM
have only that list items which is currently visible in
the scroll window.
83
Virtualization Fig.
84
Virtualization Supporting Libraries
Virtualization can be achieved using libraries like
react-virtualized,
react-window.
85
Thank You
86

More Related Content

PPTX
Reactjs Introduction - Virtual DOM
PPTX
Node js Chapter-2
PDF
The complete-beginners-guide-to-react dyrr
PPTX
Building Reliable Applications Using React, .NET & Azure
PDF
Node JS Express: Steps to Create Restful Web App
PPTX
Test Policy and Practices
PDF
Real World AngularJS recipes: beyond TodoMVC
PDF
Node, express & sails
Reactjs Introduction - Virtual DOM
Node js Chapter-2
The complete-beginners-guide-to-react dyrr
Building Reliable Applications Using React, .NET & Azure
Node JS Express: Steps to Create Restful Web App
Test Policy and Practices
Real World AngularJS recipes: beyond TodoMVC
Node, express & sails

What's hot (20)

PPTX
Node js Introduction
PPT
PDF
Best node js course
PDF
Conquering AngularJS Limitations
PPTX
Angular 2 Migration - JHipster Meetup 6
PPTX
React js Demo Explanation
PDF
A Closer Look At React Native
PDF
Angular - Chapter 1 - Introduction
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
PPTX
Node js training (1)
PDF
The curious Life of JavaScript - Talk at SI-SE 2015
PDF
Angular 2 overview
PPTX
Lecture android best practices
PPTX
React js Online Training
PDF
From MEAN to the MERN Stack
PDF
Java Intro: Unit1. Hello World
PPTX
Node js Global Packages
PPTX
Integration Testing with Selenium
PDF
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
PPT
Node.js an introduction
Node js Introduction
Best node js course
Conquering AngularJS Limitations
Angular 2 Migration - JHipster Meetup 6
React js Demo Explanation
A Closer Look At React Native
Angular - Chapter 1 - Introduction
Asp.Net Core MVC , Razor page , Entity Framework Core
Node js training (1)
The curious Life of JavaScript - Talk at SI-SE 2015
Angular 2 overview
Lecture android best practices
React js Online Training
From MEAN to the MERN Stack
Java Intro: Unit1. Hello World
Node js Global Packages
Integration Testing with Selenium
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Node.js an introduction
Ad

Similar to Web Performance & Latest in React (20)

PDF
How to increase the ui performance of apps designed using react
PDF
Top 5 React Performance Optimization Techniques in 2023
PDF
a-detailed-guide-everything-you-need-to-know-about-reactjs.pdf
PPTX
Top 10 Techniques For React Performance Optimization in 2022.pptx
PDF
Creating Hyper Performant Web Apps with React
PDF
Using React for the Mobile Web
PPTX
This Is the ppt of How the react js work in the dealy life
DOCX
React JS Components & Its Importance.docx
DOCX
React Components and Its Importance.docx
PPTX
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
PDF
The Journey of a Pixel in a React Application
PPTX
Reactjs notes.pptx for web development- tutorial and theory
PPTX
How To Upgrade The React 18 Release Candidate.pptx
PPTX
2.React tttttttttttttttttttttttttttttttt
PDF
Dive into React Performance
PPTX
theory-slides-for react for beginners.pptx
PDF
Matheus Albuquerque "The best is yet to come: the Future of React"
PDF
Fundamental Concepts of React JS for Beginners.pdf
PDF
react hook and wesite making structure ppt
PDF
An Intense Overview of the React Ecosystem
How to increase the ui performance of apps designed using react
Top 5 React Performance Optimization Techniques in 2023
a-detailed-guide-everything-you-need-to-know-about-reactjs.pdf
Top 10 Techniques For React Performance Optimization in 2022.pptx
Creating Hyper Performant Web Apps with React
Using React for the Mobile Web
This Is the ppt of How the react js work in the dealy life
React JS Components & Its Importance.docx
React Components and Its Importance.docx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
The Journey of a Pixel in a React Application
Reactjs notes.pptx for web development- tutorial and theory
How To Upgrade The React 18 Release Candidate.pptx
2.React tttttttttttttttttttttttttttttttt
Dive into React Performance
theory-slides-for react for beginners.pptx
Matheus Albuquerque "The best is yet to come: the Future of React"
Fundamental Concepts of React JS for Beginners.pdf
react hook and wesite making structure ppt
An Intense Overview of the React Ecosystem
Ad

More from Talentica Software (20)

PPTX
Webpack/Parcel: What’s Happening Behind the React App?
PPTX
Typescript: Beginner to Advanced
PDF
PPTX
Nodejs Chapter 3 - Design Pattern
PPTX
Node.js Chapter1
PDF
Micro Frontends
PPTX
Advanced JavaScript
PPTX
Setting Up Development Environment For Google App Engine & Python | Talentica
PPTX
Connected World in android - Local data sharing and service discovery
PPTX
Mobile App Monetization - Ecosystem & Emerging Trends
PPT
Android Media Player Development
PPTX
Cross Platform Mobile Technologies
PPT
Big Data Technologies - Hadoop
PPTX
Big Data – Are You Ready?
PDF
Legacy modernization
PPT
Continous Integration: A Case Study
PPTX
Technology Challenges in Building New Media Applications
PPT
Flex on Grails - Rich Internet Applications With Rapid Application Development
PPT
Building scalable and language independent java services using apache thrift
Webpack/Parcel: What’s Happening Behind the React App?
Typescript: Beginner to Advanced
Nodejs Chapter 3 - Design Pattern
Node.js Chapter1
Micro Frontends
Advanced JavaScript
Setting Up Development Environment For Google App Engine & Python | Talentica
Connected World in android - Local data sharing and service discovery
Mobile App Monetization - Ecosystem & Emerging Trends
Android Media Player Development
Cross Platform Mobile Technologies
Big Data Technologies - Hadoop
Big Data – Are You Ready?
Legacy modernization
Continous Integration: A Case Study
Technology Challenges in Building New Media Applications
Flex on Grails - Rich Internet Applications With Rapid Application Development
Building scalable and language independent java services using apache thrift

Recently uploaded (20)

PDF
Domain-specific knowledge and context in large language models: challenges, c...
PDF
Peak of Data & AI Encore: Scalable Design & Infrastructure
PPTX
Slides World Game (s) Great Redesign Eco Economic Epochs.pptx
PDF
Secure Java Applications against Quantum Threats
PDF
Examining Bias in AI Generated News Content.pdf
PDF
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
PDF
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf
PDF
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
PPTX
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
PDF
Technical Debt in the AI Coding Era - By Antonio Bianco
PDF
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
PPTX
Report in SIP_Distance_Learning_Technology_Impact.pptx
PDF
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
PDF
Optimizing bioinformatics applications: a novel approach with human protein d...
PDF
Human Computer Interaction Miterm Lesson
PDF
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
PDF
Advancements in abstractive text summarization: a deep learning approach
PPTX
Blending method and technology for hydrogen.pptx
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
Ebook - The Future of AI A Comprehensive Guide.pdf
Domain-specific knowledge and context in large language models: challenges, c...
Peak of Data & AI Encore: Scalable Design & Infrastructure
Slides World Game (s) Great Redesign Eco Economic Epochs.pptx
Secure Java Applications against Quantum Threats
Examining Bias in AI Generated News Content.pdf
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
Technical Debt in the AI Coding Era - By Antonio Bianco
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
Report in SIP_Distance_Learning_Technology_Impact.pptx
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
Optimizing bioinformatics applications: a novel approach with human protein d...
Human Computer Interaction Miterm Lesson
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
Advancements in abstractive text summarization: a deep learning approach
Blending method and technology for hydrogen.pptx
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
Ebook - The Future of AI A Comprehensive Guide.pdf

Web Performance & Latest in React