際際滷

際際滷Share a Scribd company logo
The Journey
of a Pixel in
a React
Application
Shem Magnezi
Shem Magnezi
CTO & Co-founder @ Wilco
Prev: WeWork, Meta
@shemag8
Web development is so
easy these days!
(Maybe too easy.)
Understanding the 鍖ow will help with:
 Performance Optimization
 Efficient Debugging and Troubleshooting
 Improved SEO and Accessibility
 Better User Experience
 Effective Use of Modern Web Technologies
 Resource Management and Cost Efficiency
 Collaboration and Communication
The Journey of a Pixel in a React Application
Theres a lot going on
here, lets break it
down:
1. Initial Request and DNS Resolution
The browser parses the URL and performs DNS resolution to
translate the domain name into an IP address. Generally we
don't have a lot of control here.
Optimizations:
1. Use a fast DNS provider.
2. Enable DNS prefetching.
3. Implement DNS caching.
2. HTTP Request and Server Response
The browser sends an HTTP GET request to the server, which
processes the request and sends back the HTML document.
Optimizations:
1. Optimize server response times.
2. Implement server-side caching.
3. Loading the Initial HTML Document
The browser starts parsing the HTML document and building
the DOM.
Optimizations:
1. Optimize HTML.
2. Use server-side rendering (SSR) for faster initial load.
3. Use content delivery networks (CDNs).
4. Resource Fetching from the Network
The browser fetches external resources like CSS, JavaScript,
and images.
Optimizations:
1. Use HTTP/2 to reduce latency.
2. Use resource compression (gzip, Brotli).
3. Implement lazy loading for images and other media.
4. Use asynchronous and deferred loading for
non-critical resources.
5. JavaScript Execution
The browser parses and executes JavaScript 鍖les, initializing
the application.
Optimizations:
1. Minimize and bundle JavaScript 鍖les.
2. Use tree shaking to remove unused code.
3. Implement code splitting to load only necessary
JavaScript.
6. React Lifecycle
React components go through lifecycle methods (e.g.,
mounting, updating, unmounting).
Optimizations:
1. Use React best practices.
2. Optimize component state management.
7. React Virtual DOM Creation and Merging
React creates a virtual DOM and reconciles it with the real
DOM, updating only the necessary parts.
Optimizations:
1. Use keys correctly in lists to optimize diffing.
2. Avoid large and complex component trees.
3. Optimize the rendering of frequently updated
components.
8. Data Fetching
React components fetch data asynchronously, to show some
data.
Optimizations:
1. Use caching for frequently requested data.
2. Implement data fetching strategies like pagination and
in鍖nite scroll.
3. Use service workers for offline caching.
9. State Update and DOM Reconciliation
State changes trigger re-renders, and React reconciles the
virtual DOM with the real DOM.
Optimizations:
1. Manage state in a smart way.
2. Avoid deep nesting of stateful components.
10. Final Rendering and User Interaction
The browser completes rendering the webpage, and the user
can interact with it.
Optimizations:
1. Ensure smooth interactions with optimized event
handlers.
The Journey of a Pixel in a React Application
The Journey of a Pixel in a React Application
Initial Request
and DNS Resolution
HTTP Request and
Server Response
Loading the Initial
HTML Document
Resource Fetching
from the Network
JavaScript
Execution
React Virtual DOM
Creation and Merging
State Update and DOM
Reconciliation
Final Rendering
and User Interaction
React
Lifecycle
Data
Fetching
Question?

More Related Content

Similar to The Journey of a Pixel in a React Application (20)

Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
John McCaffrey
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
John McCaffrey
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
Jeremy Likness
React for .net developers
React for .net developersReact for .net developers
React for .net developers
macsdickinson
Dust.js
Dust.jsDust.js
Dust.js
Yevgeniy Brikman
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
tkramar
React + Mobile
React + MobileReact + Mobile
React + Mobile
antriss
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfgNEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
Siarhei Barysiuk
Performace optimization (increase website speed)
Performace optimization (increase website speed)Performace optimization (increase website speed)
Performace optimization (increase website speed)
clickramanm
React js Rahil Memon
React js Rahil MemonReact js Rahil Memon
React js Rahil Memon
RahilMemon5
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve It
Nexcess.net LLC
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Karla Mae Tejon
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
Geoff Harcourt
Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo Fonseca
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
Betclic Everest Group Tech Team
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
Eugene Lazutkin
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testing
Roman Ananev
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
Andy Kucharski
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
John McCaffrey
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
John McCaffrey
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
Jeremy Likness
React for .net developers
React for .net developersReact for .net developers
React for .net developers
macsdickinson
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
tkramar
React + Mobile
React + MobileReact + Mobile
React + Mobile
antriss
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfgNEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
NEXTjs.pptxfggfgfdgfgfdgfdgfdgfdgfdgfdgfg
zmulani8
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
Siarhei Barysiuk
Performace optimization (increase website speed)
Performace optimization (increase website speed)Performace optimization (increase website speed)
Performace optimization (increase website speed)
clickramanm
React js Rahil Memon
React js Rahil MemonReact js Rahil Memon
React js Rahil Memon
RahilMemon5
The Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve ItThe Importance of Site Performance and Simple Steps to Achieve It
The Importance of Site Performance and Simple Steps to Achieve It
Nexcess.net LLC
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Mage uk-2013-1345-chris-wells-131030120920-phpapp01
Karla Mae Tejon
Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo Fonseca
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
Eugene Lazutkin
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testing
Roman Ananev
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
Andy Kucharski

More from Shem Magnezi (17)

AI funnel optimization talk - Shem Magnezi
AI funnel optimization talk - Shem MagneziAI funnel optimization talk - Shem Magnezi
AI funnel optimization talk - Shem Magnezi
Shem Magnezi
The Future of Work(ers)
The Future of Work(ers)The Future of Work(ers)
The Future of Work(ers)
Shem Magnezi
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Shem Magnezi
Good rules for bad apps
Good rules for bad appsGood rules for bad apps
Good rules for bad apps
Shem Magnezi
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Shem Magnezi
Iterating on your idea
Iterating on your ideaIterating on your idea
Iterating on your idea
Shem Magnezi
The Redux State of the Art
The Redux State of the ArtThe Redux State of the Art
The Redux State of the Art
Shem Magnezi
Startup hackers toolbox
Startup hackers toolboxStartup hackers toolbox
Startup hackers toolbox
Shem Magnezi
Fuck you startup world
Fuck you startup worldFuck you startup world
Fuck you startup world
Shem Magnezi
The Future of Work
The Future of WorkThe Future of Work
The Future of Work
Shem Magnezi
Android Developer Toolbox 2017
Android Developer Toolbox 2017Android Developer Toolbox 2017
Android Developer Toolbox 2017
Shem Magnezi
Good rules for bad apps
Good rules for bad appsGood rules for bad apps
Good rules for bad apps
Shem Magnezi
Building android apps with kotlin
Building android apps with kotlinBuilding android apps with kotlin
Building android apps with kotlin
Shem Magnezi
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
Shem Magnezi
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
Shem Magnezi
Know what (not) to build
Know what (not) to buildKnow what (not) to build
Know what (not) to build
Shem Magnezi
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricks
Shem Magnezi
AI funnel optimization talk - Shem Magnezi
AI funnel optimization talk - Shem MagneziAI funnel optimization talk - Shem Magnezi
AI funnel optimization talk - Shem Magnezi
Shem Magnezi
The Future of Work(ers)
The Future of Work(ers)The Future of Work(ers)
The Future of Work(ers)
Shem Magnezi
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Shem Magnezi
Good rules for bad apps
Good rules for bad appsGood rules for bad apps
Good rules for bad apps
Shem Magnezi
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Micro Frontends- You Keep Using That Word, I Dont Think It Means What You ...
Shem Magnezi
Iterating on your idea
Iterating on your ideaIterating on your idea
Iterating on your idea
Shem Magnezi
The Redux State of the Art
The Redux State of the ArtThe Redux State of the Art
The Redux State of the Art
Shem Magnezi
Startup hackers toolbox
Startup hackers toolboxStartup hackers toolbox
Startup hackers toolbox
Shem Magnezi
Fuck you startup world
Fuck you startup worldFuck you startup world
Fuck you startup world
Shem Magnezi
The Future of Work
The Future of WorkThe Future of Work
The Future of Work
Shem Magnezi
Android Developer Toolbox 2017
Android Developer Toolbox 2017Android Developer Toolbox 2017
Android Developer Toolbox 2017
Shem Magnezi
Good rules for bad apps
Good rules for bad appsGood rules for bad apps
Good rules for bad apps
Shem Magnezi
Building android apps with kotlin
Building android apps with kotlinBuilding android apps with kotlin
Building android apps with kotlin
Shem Magnezi
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
Shem Magnezi
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
Shem Magnezi
Know what (not) to build
Know what (not) to buildKnow what (not) to build
Know what (not) to build
Shem Magnezi
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricks
Shem Magnezi

Recently uploaded (20)

Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Tobias Schneck
Microsoft Digital Defense Report 2024 .pdf
Microsoft Digital Defense Report 2024 .pdfMicrosoft Digital Defense Report 2024 .pdf
Microsoft Digital Defense Report 2024 .pdf
Abhishek Agarwal
Codequiry: A Code Similarity Checker Every Developer Should Know
Codequiry: A Code Similarity Checker Every Developer Should KnowCodequiry: A Code Similarity Checker Every Developer Should Know
Codequiry: A Code Similarity Checker Every Developer Should Know
Code Quiry
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
3G4G
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
David Brossard
Threat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community DayThreat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community Day
Teri Radichel
Meet CrewAI The Framework Powering Agentic AI (2).pdf
Meet CrewAI The Framework Powering Agentic AI (2).pdfMeet CrewAI The Framework Powering Agentic AI (2).pdf
Meet CrewAI The Framework Powering Agentic AI (2).pdf
Yodaplus Technologies Private Limited
Convert EML files to PST on Mac operating system
Convert EML files to PST on Mac operating systemConvert EML files to PST on Mac operating system
Convert EML files to PST on Mac operating system
Rachel Walker
AI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting HiringAI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting Hiring
Beyond Chiefs
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready   Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready
Precisely
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEA
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEAQ1 FY26 TUG Leader Quarterly Call - APAC / EMEA
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEA
lward7
Innovative Web Design | Malachite Technologies
Innovative Web Design | Malachite TechnologiesInnovative Web Design | Malachite Technologies
Innovative Web Design | Malachite Technologies
malachitetechnologie1
Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
APAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdfAPAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdf
GDG on Campus Monash
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryDataNew from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
BookNet Canada
San Francisco Atlassian ACE - Mar 27 2025.pdf
San Francisco Atlassian ACE - Mar 27 2025.pdfSan Francisco Atlassian ACE - Mar 27 2025.pdf
San Francisco Atlassian ACE - Mar 27 2025.pdf
Matt Doar
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
Pavel Shukhman
Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Evaluating Global Load Balancing Options for Kubernetes in Practice (Kubermat...
Tobias Schneck
Microsoft Digital Defense Report 2024 .pdf
Microsoft Digital Defense Report 2024 .pdfMicrosoft Digital Defense Report 2024 .pdf
Microsoft Digital Defense Report 2024 .pdf
Abhishek Agarwal
Codequiry: A Code Similarity Checker Every Developer Should Know
Codequiry: A Code Similarity Checker Every Developer Should KnowCodequiry: A Code Similarity Checker Every Developer Should Know
Codequiry: A Code Similarity Checker Every Developer Should Know
Code Quiry
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
Misc: The Internet Story - How Data Travels, Transit Works, and the Role of C...
3G4G
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
AuthZEN The OpenID Connect of Authorization - Gartner IAM EMEA 2025
David Brossard
Threat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community DayThreat Modeling a Batch Job System - AWS Security Community Day
Threat Modeling a Batch Job System - AWS Security Community Day
Teri Radichel
Convert EML files to PST on Mac operating system
Convert EML files to PST on Mac operating systemConvert EML files to PST on Mac operating system
Convert EML files to PST on Mac operating system
Rachel Walker
AI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting HiringAI in Talent Acquisition: Boosting Hiring
AI in Talent Acquisition: Boosting Hiring
Beyond Chiefs
Getting the Best of TrueDEM April News & Updates
Getting the Best of TrueDEM  April News & UpdatesGetting the Best of TrueDEM  April News & Updates
Getting the Best of TrueDEM April News & Updates
panagenda
Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready   Top Tips to Get Your Data AI-Ready
Top Tips to Get Your Data AI-Ready
Precisely
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEA
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEAQ1 FY26 TUG Leader Quarterly Call - APAC / EMEA
Q1 FY26 TUG Leader Quarterly Call - APAC / EMEA
lward7
Innovative Web Design | Malachite Technologies
Innovative Web Design | Malachite TechnologiesInnovative Web Design | Malachite Technologies
Innovative Web Design | Malachite Technologies
malachitetechnologie1
Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
APAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdfAPAC Solutions Challenge Info Session.pdf
APAC Solutions Challenge Info Session.pdf
GDG on Campus Monash
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryDataNew from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
New from BookNet Canada for 2025: BNC SalesData and BNC LibraryData
BookNet Canada
San Francisco Atlassian ACE - Mar 27 2025.pdf
San Francisco Atlassian ACE - Mar 27 2025.pdfSan Francisco Atlassian ACE - Mar 27 2025.pdf
San Francisco Atlassian ACE - Mar 27 2025.pdf
Matt Doar
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
From SBOMs to xBOMs to Transparency - Pavel Shukhman at OWASP Ottawa on 2025-...
Pavel Shukhman

The Journey of a Pixel in a React Application

  • 1. The Journey of a Pixel in a React Application Shem Magnezi
  • 2. Shem Magnezi CTO & Co-founder @ Wilco Prev: WeWork, Meta @shemag8
  • 3. Web development is so easy these days!
  • 5. Understanding the 鍖ow will help with: Performance Optimization Efficient Debugging and Troubleshooting Improved SEO and Accessibility Better User Experience Effective Use of Modern Web Technologies Resource Management and Cost Efficiency Collaboration and Communication
  • 7. Theres a lot going on here, lets break it down:
  • 8. 1. Initial Request and DNS Resolution The browser parses the URL and performs DNS resolution to translate the domain name into an IP address. Generally we don't have a lot of control here. Optimizations: 1. Use a fast DNS provider. 2. Enable DNS prefetching. 3. Implement DNS caching.
  • 9. 2. HTTP Request and Server Response The browser sends an HTTP GET request to the server, which processes the request and sends back the HTML document. Optimizations: 1. Optimize server response times. 2. Implement server-side caching.
  • 10. 3. Loading the Initial HTML Document The browser starts parsing the HTML document and building the DOM. Optimizations: 1. Optimize HTML. 2. Use server-side rendering (SSR) for faster initial load. 3. Use content delivery networks (CDNs).
  • 11. 4. Resource Fetching from the Network The browser fetches external resources like CSS, JavaScript, and images. Optimizations: 1. Use HTTP/2 to reduce latency. 2. Use resource compression (gzip, Brotli). 3. Implement lazy loading for images and other media. 4. Use asynchronous and deferred loading for non-critical resources.
  • 12. 5. JavaScript Execution The browser parses and executes JavaScript 鍖les, initializing the application. Optimizations: 1. Minimize and bundle JavaScript 鍖les. 2. Use tree shaking to remove unused code. 3. Implement code splitting to load only necessary JavaScript.
  • 13. 6. React Lifecycle React components go through lifecycle methods (e.g., mounting, updating, unmounting). Optimizations: 1. Use React best practices. 2. Optimize component state management.
  • 14. 7. React Virtual DOM Creation and Merging React creates a virtual DOM and reconciles it with the real DOM, updating only the necessary parts. Optimizations: 1. Use keys correctly in lists to optimize diffing. 2. Avoid large and complex component trees. 3. Optimize the rendering of frequently updated components.
  • 15. 8. Data Fetching React components fetch data asynchronously, to show some data. Optimizations: 1. Use caching for frequently requested data. 2. Implement data fetching strategies like pagination and in鍖nite scroll. 3. Use service workers for offline caching.
  • 16. 9. State Update and DOM Reconciliation State changes trigger re-renders, and React reconciles the virtual DOM with the real DOM. Optimizations: 1. Manage state in a smart way. 2. Avoid deep nesting of stateful components.
  • 17. 10. Final Rendering and User Interaction The browser completes rendering the webpage, and the user can interact with it. Optimizations: 1. Ensure smooth interactions with optimized event handlers.
  • 20. Initial Request and DNS Resolution HTTP Request and Server Response Loading the Initial HTML Document Resource Fetching from the Network JavaScript Execution React Virtual DOM Creation and Merging State Update and DOM Reconciliation Final Rendering and User Interaction React Lifecycle Data Fetching