nik72619c
@niksharma1997
https://medium.com/@nikhilsharmarockstar21/
Lazy Loading ,Code Splitting and profiling
Virtualization with windowing
Removing un-necessary re-renders
React's Reconciliation
If the markup contains an external JavaScript file, the browser stops loading the HTML and starts downloading that external JavaScript – render blocking or parser blocking
The render block also causes Resource blocking, when the external JavaScript files blocks other resources like markup, media etc. from downloading into the web browser.
1. Dynamically load component using React.lazy()
2. USE SUSPENSE TO ADD A FALLBACK TILL THE TIME THE COMPONENT RENDERS
3. CHECK THE NETWORKS TAB AND BOOM !
THE RENDER INSPECTOR
TRACK USER EVENTS AND DETERMINE WHAT CAUSED THE RENDER
Lazy Loading ,Code Splitting and profiling
Virtualization with windowing
Removing un-necessary re-renders
React's Reconciliation
Real life Applications usually render complex components
impact on DOM performance
The lesser work you do...
Lazy Loading ,Code Splitting and profiling
Virtualization with windowing
Removing un-necessary re-renders
React's Reconciliation
React keeps in memory two versions of the DOM:
Cousin of shouldComponentUpdate
implements shouldComponentUpdate
export default class Mycomponent extends React.PureComponent{
//your regular code
}
Lazy Loading ,Code Splitting and profiling
Virtualization with windowing
Removing un-necessary re-renders
React's Reconciliation
REACT's SECRET INGREDIENT!
React's render() returns a new VirtualDOM on prop/state change
state of the art algos=> O(n^3)
DOM Elements Of The Same Type
Elements Of Different Types
Component Elements Of The Same Type
componentWillReceiveProps() and componentWillUpdate()
REACT'S RECONCIALIATION IDENTIFIES THE CHILDREN BASED ON THE KEY PROP
Lazy Loading ,Code Splitting and profiling
Virtualization with windowing
Removing un-necessary re-renders
React's Reconciliation
FIND THE CODE AT:-
https://github.com/nik72619c/Facebook-Dev-Circles-Talk
https://codesandbox.io/s/nnqmmmz1o0
https://github.com/nik72619c/Optimise_Rerenders_Facebook_DevC