Slide 1

Slide 1 text

Vitor Alencar

Slide 2

Slide 2 text

Agenda React Re-render Manual Memoization React Compiler Rules of react How to adopt

Slide 3

Slide 3 text

What When Where @vitormalencar

Slide 4

Slide 4 text

What When Where @vitormalencar

Slide 5

Slide 5 text

What When Where @vitormalencar

Slide 6

Slide 6 text

What When Where @vitormalencar React Compiler Automating Performance Optimization

Slide 7

Slide 7 text

< > < > < = > < = = > < > < = >{{ product.name }} - {{ product.price | currency }} < > app angular. ( , []); app. ( , ( ) { $scope.products [ { name: , price: }, { name: , price: }, { name: , price: } ]; }); DOCTYPE html head script script head body ul li li ul script script body html html src ng-app ng-controller ng-repeat module controller "https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js" "productApp" "ProductController" "product in products" 'productApp' 'ProductController' 'Product 1' 'Product 2' 'Product 3' var = function = $scope 10.00 20.00 30.00

Slide 8

Slide 8 text

class extends constructor = = => const = + const = * => ... return => = = { ( ) { (props); .state { products: [ { name: , price: }, { name: , price: }, { name: , price: } ] }; } () { .state.products. ; { name: newProductNumber , price: newProductNumber }; . (( ) ({ products: [ prevState.products, newProduct] })); }; () { ( < > < > { .state.products. (( , ) ( < {index}> {product.name} - ${product.price. ( )} ))} < { .addProduct}>Add Products ); } } ProductList Component addProduct setState render map key toFixed onClick props prevState product index super this 10.00 20.00 30.00 newProductNumber this length 1 newProduct 10.00 this this 2 this 'Product 1' 'Product 2' 'Product 3' `Product ${ }` div ul li li ul button button div

Slide 9

Slide 9 text

class extends constructor = = => const = + const = * => ... return { ( ) { (props); .state { products: [ { name: , price: }, { name: , price: }, { name: , price: } ] }; } () { .state.products. ; { name: newProductNumber , price: newProductNumber }; . (( ) ({ products: [ prevState.products, newProduct] })); }; () { ( < > < > ProductList Component addProduct setState render props prevState super this 10.00 20.00 30.00 newProductNumber this length 1 newProduct 10.00 this 'Product 1' 'Product 2' 'Product 3' `Product ${ }` div ul

Slide 10

Slide 10 text

= => const = + const = * => ... return => = = () { .state.products. ; { name: newProductNumber , price: newProductNumber }; . (( ) ({ products: [ prevState.products, newProduct] })); }; () { ( < > < > { .state.products. (( , ) ( < {index}> {product.name} - ${product.price. ( )} ))} < { .addProduct}>Add Products ); } } addProduct setState render map key toFixed onClick prevState product index newProductNumber this length 1 newProduct 10.00 this this 2 this `Product ${ }` div ul li li ul button button div

Slide 11

Slide 11 text

const = => const = const = => const = + const = * ... return => = = () { [ , ] ([ { name: , price: }, { name: , price: }, { name: , price: }, ]); () { products. ; { name: newProductNumber , price: newProductNumber , }; ([ products, newProduct]); }; ( < > < > {products. (( , ) ( < {index}> {product.name} - ${product.price. ( )} ))} < {addProduct}>Add Product ); }; ProductList useState addProduct setProducts map key toFixed onClick products setProducts 10.0 20.0 30.0 newProductNumber length 1 newProduct 10.0 2 "Product 1" "Product 2" "Product 3" `Product ${ }` div ul li li ul button button div product index

Slide 12

Slide 12 text

const = => const = const = => const = + const = * ... return () { [ , ] ([ { name: , price: }, { name: , price: }, { name: , price: }, ]); () { products. ; { name: newProductNumber , price: newProductNumber , }; ([ products, newProduct]); }; ( ProductList useState addProduct setProducts products setProducts 10.0 20.0 30.0 newProductNumber length 1 newProduct 10.0 "Product 1" "Product 2" "Product 3" `Product ${ }`

Slide 13

Slide 13 text

Creating amazing experiences

Slide 14

Slide 14 text

Creating amazing experiences

Slide 15

Slide 15 text

Until you open devtools

Slide 16

Slide 16 text

Understanding React Re-rendering Mechanism

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

PARENT

Slide 19

Slide 19 text

PARENT

Slide 20

Slide 20 text

PARENT

Slide 21

Slide 21 text

Reactive UI React can sometimes be overly reactive.

Slide 22

Slide 22 text

Current options Manual Memoization

Slide 23

Slide 23 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> ) } MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary itemm currentCart cartItem cartItem total item total item div div

Slide 24

Slide 24 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary item currentCart cartItem cartItem total item total item div div

Slide 25

Slide 25 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary item currentCart cartItem cartItem total item total item div div

Slide 26

Slide 26 text

USECALLBACK export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary item currentCart cartItem cartItem total item total item div div

Slide 27

Slide 27 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary item currentCart cartItem cartItem total item total item div div

Slide 28

Slide 28 text

USEMEMO export default function const = const = => => const = => === if return => === ? ... + : return ... const = => => + const = => => + * return = = = = () { [ , ] ([]); ( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> MobileEcommerce useState addToCart setCart find map getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice cart setCart existingItem 1 1 0 0 ProductList CartSummary item currentCart cartItem cartItem total item total item div div

Slide 29

Slide 29 text

return ... const = => => + const = => => + * return = = = = ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> ) } getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice 1 0 0 ProductList CartSummary total item total item div div

Slide 30

Slide 30 text

REACT.MEMO return ... const = => => + const = => => + * return = = = = ); } [ currentCart, { item, quantity: }]; }); }; () cart. (( , ) total item.quantity, ); () cart. (( , ) total item.item.price item.quantity, ); ( < > < {products} {addToCart} /> < { ()} { ()} /> ) } getTotalItems reduce getTotalPrice reduce products addToCart totalItems getTotalItems totalPrice getTotalPrice 1 0 0 ProductList CartSummary total item total item div div

Slide 31

Slide 31 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => return => + * return = = = = () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo reduce products addToCart totalItems totalPrice cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice 0 ProductList CartSummary item currentCart cartItem cartItem total cartItem total cartItem // Memoized computed values div div

Slide 32

Slide 32 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice item currentCart cartItem cartItem total cartItem // Memoized computed values

Slide 33

Slide 33 text

return ... const = => return => + const = => return => + * return = = = = ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } useMemo reduce useMemo reduce products addToCart totalItems totalPrice 1 totalItems 0 totalPrice 0 ProductList CartSummary total cartItem total cartItem // Memoized computed values div div

Slide 34

Slide 34 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => return => + * return = = = = () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo reduce products addToCart totalItems totalPrice cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice 0 ProductList CartSummary item currentCart cartItem cartItem total cartItem total cartItem // Memoized computed values div div

Slide 35

Slide 35 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => return => + * return = = = = () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo reduce products addToCart totalItems totalPrice cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice 0 ProductList CartSummary item currentCart cartItem cartItem total cartItem total cartItem // Memoized computed values div div

Slide 36

Slide 36 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice item currentCart cartItem cartItem total cartItem // Memoized computed values

Slide 37

Slide 37 text

? ... + : return ... const = => return => + const = => return => + * return = = = = { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } useMemo reduce useMemo reduce products addToCart totalItems totalPrice 1 1 totalItems 0 totalPrice 0 ProductList CartSummary total cartItem total cartItem // Memoized computed values div div

Slide 38

Slide 38 text

State references Reference identity Easy to break export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => return => + * return = = = = () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo reduce products addToCart totalItems totalPrice cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice 0 ProductList CartSummary item currentCart cartItem cartItem total cartItem total cartItem // Memoized computed values div div

Slide 39

Slide 39 text

export default function const = const = => => const = => === if return => === ? ... + : return ... const = => return => + const = => return => + * return = = = = () { [ , ] ([]); (( ) { (( ) { currentCart. ( ( ) cartItem.item.id item.id ); (existingItem) { currentCart. (( ) cartItem.item.id item.id { cartItem, quantity: cartItem.quantity } cartItem ); } [ currentCart, { item, quantity: }]; }); }, []); (() { cart. (( , ) total cartItem.quantity, ); }, [cart]); (() { cart. ( ( , ) total cartItem.item.price cartItem.quantity, ); }, [cart]); ( < > < {products} {addToCart} /> < {totalItems} {totalPrice} /> ); } MobileEcommerceOptimized useState useCallback setCart find map useMemo reduce useMemo reduce products addToCart totalItems totalPrice cart setCart addToCart existingItem 1 1 totalItems 0 totalPrice 0 ProductList CartSummary item currentCart cartItem cartItem total cartItem total cartItem // Memoized computed values div div

Slide 40

Slide 40 text

Just Imagine Spending hours optimizing your React app, meticulously placing and , only to discover that you missed a `useMemo` `useCallback` component

Slide 41

Slide 41 text

Just Imagine Or worse, someone else on your team does it without even realizing.

Slide 42

Slide 42 text

Automating Optimization Enter the Compiler

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

AST build ir code optimized code Codegen

Slide 45

Slide 45 text

AST build ir code optimized code Codegen

Slide 46

Slide 46 text

AST build ir code optimized code Codegen 46 Steps

Slide 47

Slide 47 text

eslint Compiler core babel plugin

Slide 48

Slide 48 text

AST Exploration Decides which functions to compile in a file using plugin options and local directives. The plugin invokes the compiler for each component or hook, replacing the original function with a new AST node.

Slide 49

Slide 49 text

AST Exploration Decides which functions to compile in a file using plugin options and local directives. The plugin invokes the compiler for each component or hook, replacing the original function with a new AST node.

Slide 50

Slide 50 text

Lowering (BuildHIR) The compiler first converts the Babel AST into React Compiler's HIR (High-level Intermediate Representation). Each block consists of instructions and a terminal, facilitating block iteration with consideration for predecessors and successors, especially in loops.

Slide 51

Slide 51 text

Lowering (BuildHIR) The compiler first converts the Babel AST into React Compiler's HIR (High-level Intermediate Representation). Each block consists of instructions and a terminal, facilitating block iteration with consideration for predecessors and successors, especially in loops.

Slide 52

Slide 52 text

Lowering (BuildHIR) The compiler first converts the Babel AST into React Compiler's HIR (High-level Intermediate Representation). Each block consists of instructions and a terminal, facilitating block iteration with consideration for predecessors and successors, especially in loops.

Slide 53

Slide 53 text

Optimizing Various passes such as dead code elimination and constant propagation can generally improve performance and reduce the amount of instructions to be optimized later.

Slide 54

Slide 54 text

optimizing Various passes such as dead code elimination and constant propagation can generally improve performance and reduce the amount of instructions to be optimized later.

Slide 55

Slide 55 text

Codegen The compiler optimisations process generates the final optimised version of your code

Slide 56

Slide 56 text

Codegen Various passes such as dead code elimination and constant propagation can generally improve performance and reduce the amount of instructions to be optimized later.

Slide 57

Slide 57 text

Codegen Various passes such as dead code elimination and constant propagation can generally improve performance and reduce the amount of instructions to be optimized later.

Slide 58

Slide 58 text

Static Values let if === = = else = const = initialCart; (memoCache[ ] Symbol. ( )) { initialCart []; memoCache[ ] initialCart; } { initialCart memoCache[ ]; } [ , ] (initialCart); 0 0 0 cart setCart for useState "react.memo_cache_sentinel" The compiler memoizes the initial state [] to avoid recreating the empty array on every render

Slide 59

Slide 59 text

Functions helps in preventing unnecessary re-renders of child components that receive addToCart as a prop. let if === const = => = = else = memoizedAddToCart; (memoCache[ ] Symbol. ( )) { ( ) { }; memoizedAddToCart addToCart; memoCache[ ] memoizedAddToCart; } { memoizedAddToCart memoCache[ ]; } 1 1 1 for addToCart "react.memo_cache_sentinel" item // Function body...

Slide 60

Slide 60 text

On subsequent renders, if the dependencies haven't changed, the memoized output is returned directly. JSX Output let if === = = = = = = else = return memoizedOutput; (memoCache[ ] Symbol. ( )) { ( < > < {products} {memoizedAddToCart} /> < { ()} { ()} /> ); memoCache[ ] memoizedOutput; } { memoizedOutput memoCache[ ]; } memoizedOutput; 2 ProductList CartSummary 2 2 for memoizedOutput products addToCart totalItems getTotalItems totalPrice getTotalPrice "react.memo_cache_sentinel" div div

Slide 61

Slide 61 text

Summary Static Values Initial state values like empty arrays or objects are memoized to prevent re-creation. Functions Functions defined inside the component (e.g., addToCart) are memoized to maintain referential equality across renders. Memoization of JSX Output The entire render output is memoized when safe to do so. Compiler Optimizations @Vitormalencar

Slide 62

Slide 62 text

what we can do We've achieved beyond feature parity, improved memoization, and enhanced performance while maintaining developer experience.

Slide 63

Slide 63 text

what we can do We've achieved beyond feature parity, improved memoization, and enhanced performance while maintaining developer experience.

Slide 64

Slide 64 text

what we can do We've achieved beyond feature parity, improved memoization, and enhanced performance while maintaining developer experience.

Slide 65

Slide 65 text

Here is where the gold is For my friends

Slide 66

Slide 66 text

Your Workflow Adopting Compiler

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Install Make work Make Right Make better

Slide 69

Slide 69 text

Install

Slide 70

Slide 70 text

Install

Slide 71

Slide 71 text

Install

Slide 72

Slide 72 text

For the compilation to work, it assumes that you are following the rules of React. Not magic

Slide 73

Slide 73 text

Rules Of React Components and Hooks must be pure React calls Components and Hooks The Rules of Hooks Compiler Optimizations @Vitormalencar

Slide 74

Slide 74 text

After enabling the compiler, continue debugging the app for optimal performance. You may be surprised... Do manual checks

Slide 75

Slide 75 text

Skiping compilation export default function const = => const = return => = ({ }) { [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name newNames setNewNames sortedNames ul li li ul

Slide 76

Slide 76 text

Skiping compilation export default function const = => const = return => = ({ }) { [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name newNames setNewNames sortedNames ul li li ul

Slide 77

Slide 77 text

Skiping compilation export default function const = => const = return => = ({ }) { ; [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name "use no memo" newNames setNewNames sortedNames ul li li ul

Slide 78

Slide 78 text

Skiping compilation export default function const = => const = return => = ({ }) { ; [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name "use no memo" newNames setNewNames sortedNames ul li li ul //JIRA-ticket-124 fix this component

Slide 79

Slide 79 text

Devtools Helper

Slide 80

Slide 80 text

Always check Make benchmarks and tests to compare before and after.

Slide 81

Slide 81 text

Skiping compilation export default function const = => const = return => = ({ }) { [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name newNames setNewNames sortedNames ul li li ul

Slide 82

Slide 82 text

And again Is not magic....

Slide 83

Slide 83 text

Skiping compilation export default function const = => const = return => = ({ }) { [ , ] (names); (() { (names); }, [names]); newNames. (); ( < > {sortedNames. (( ) ( < {name}>{name} ))} ); } SortedList useState useMemo setNewNames toSorted map key names name newNames setNewNames sortedNames ul li li ul

Slide 84

Slide 84 text

Let's get it clear The React Compiler isn’t part of React 19

Slide 85

Slide 85 text

Let's get it clear The React Compiler isn’t part of React 19

Slide 86

Slide 86 text

Final Considerations

Slide 87

Slide 87 text

What is next Utilize new tools to enhance current projects.

Slide 88

Slide 88 text

What is next Certain libraries, such as MobX, may not be compatible with the new compiler.

Slide 89

Slide 89 text

What is next Just the beginning, envision expanding its capabilities beyond memoization.

Slide 90

Slide 90 text

What is next Or Maybe even removing dependency arrays altogether.... maybe

Slide 91

Slide 91 text

And Much more... There are several complex topics that we won't be able to delve into today, such as: 
 - Various use cases of memos
 - UseEffect stabilization
 - Automatic code deletion I'll cover them on my YouTube channel soon, so be sure to follow me on all my socials!

Slide 92

Slide 92 text

What When Where @vitormalencar React Compiler Automating Performance Optimization

Slide 93

Slide 93 text

What When Where @vitormalencar

Slide 94

Slide 94 text

What When Where @vitormalencar

Slide 95

Slide 95 text

What When Where @vitormalencar