keuller magalhães - react performance from scratch

9
React Optimization Tips & Tricks Twitter: @keullermag E-mail: [email protected]

Upload: react-conf-brasil

Post on 28-Jan-2018

51 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Keuller Magalhães - React Performance from Scratch

React Optimization

Tips & Tricks

Twitter: @keullermag

E-mail: [email protected]

Page 2: Keuller Magalhães - React Performance from Scratch

Agenda

- Showcase

- First Render

- Bundle Size

- Render Performance

- Webpack

- Tips

Page 3: Keuller Magalhães - React Performance from Scratch

Showcase

Demo

Page 4: Keuller Magalhães - React Performance from Scratch

First Render

Simple Form

React 189.14ms

Preact 94.16ms

Rax 68.93ms

Inferno 61.07ms

Page 5: Keuller Magalhães - React Performance from Scratch

Bundle Size

Page 6: Keuller Magalhães - React Performance from Scratch

Inferno Perf

React P

erfR

ax Perf

Preact P

erf

Render Performance

Page 7: Keuller Magalhães - React Performance from Scratch

Tips

- Each component must have single responsibility

- Use (and abuse) Functional Components

- Extends PureComponent instead of Component (React)

- Overwrite shouldComponentUpdate whenever possible

- Avoid save state in components

- Avoid controlled components

- Split out your bundle

- Configure your module bundler to optimize your production bundler

Page 8: Keuller Magalhães - React Performance from Scratch

The Winner is...

Page 9: Keuller Magalhães - React Performance from Scratch

Q & A

Twitter: @keullermag

E-mail: [email protected]