React???
React???
L azy Loading
I n React
Created By
Gagan Saini 0
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
Lazy Loading
It is an optimization technique in React that
allows you to split your application code into
smaller bundles.
Created By
Gagan Saini 1
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
Created By
Gagan Saini 2
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
Explanation
Lazy Function
The lazy function helps you to load any
component in lazy style. Means the CommentList
Component is not loaded initially. It will only load
a ack
F llb
The Fallback element will show till your
component is not loaded. Here you can give
loading elements to build good UI/UX.
Created By
Gagan Saini 3
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
Benefits
F aster Initial Load Time
y deferring the loading of non-critical
B
Im proved Performance
s users navigate the app, only the necessary
A
Created By
Gagan Saini 4
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
o arization
M dul
It encourages a more modular application
structure, making code easier to maintain and
update individual components.
Created By
Gagan Saini 5
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
When to use
Large Codebases
If your React application has a large codebase
with many components, lazy loading can be very
beneficial.
N on-Critical Features
onsider lazy loading components that aren't
C
Created By
Gagan Saini 6
Gagan Saini
@gagan-saini-gs Github: Gagan-Saini-GS
Considerations
o e Splitting Strategies
C d
ou can use techniques like code splitting by
Y
Third-Party Libraries
onsider lazy loading third-party libraries that
C