Slide 1

Slide 1 text

React Fiber by Glenn Reyes • @glnnrys

Slide 2

Slide 2 text

" React Zurich!

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

React Fiber

Slide 7

Slide 7 text

What is React Fiber?

Slide 8

Slide 8 text

• Complete rewrite of React core algorithm • Same Public API • Still being tested at Facebook internally • Release with v16 (pretty soon)

Slide 9

Slide 9 text

isfiberreadyyet.com Is Fiber Ready Yet?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Why Fiber?

Slide 12

Slide 12 text

Fiber resolves long-standing problems

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

React Fiber

Slide 17

Slide 17 text

Scheduling

Slide 18

Slide 18 text

Prioritizing

Slide 19

Slide 19 text

ReactPriorityLevel { NoWork: 0, // No work is pending. SynchronousPriority: 1, // For controlled text inputs. TaskPriority: 2, // Completes at the end of the current tick. AnimationPriority: 3, // Needs to complete before the next frame. HighPriority: 4, // Interaction that needs to complete soon LowPriority: 5, // Data fetching, or result from updating stores. OffscreenPriority: 6, // Won't be visible };

Slide 20

Slide 20 text

Pause, abort & reuse work

Slide 21

Slide 21 text

requestAnimationFrame(cb) requestIdleCallback(cb)

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Fiber

Slide 25

Slide 25 text

Fiber

Slide 26

Slide 26 text

Stack

Slide 27

Slide 27 text

• Error boundaries • No PropTypes in prod builds • Render multiple elements

Slide 28

Slide 28 text

const Foo = () => ([ foo, bar, ]);

Slide 29

Slide 29 text

How to use Fiber now?

Slide 30

Slide 30 text

Wait until there is an officially release!

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

yarn add react@next react-dom@next npm install —-save react@next react-dom@next // index.js import ReactDOM from ‘react-dom’; // default DOM

Slide 33

Slide 33 text

yarn add react@next react-dom@next npm install —-save react@next react-dom@next // index.js import ReactDOMFiber from ‘react-dom/lib/ReactDOMFiber';

Slide 34

Slide 34 text

yarn add react@next react-dom@next npm install —-save react@next react-dom@next // index.js import ReactDOMFiber from ‘react-dom/lib/ReactDOMFiber'; Don’t do this!!!

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

UMD build git clone https://github.com/facebook/react.git yarn yarn run build → /build/react-dom-fiber.min.js

Slide 38

Slide 38 text

facebook.com/groups/ reactfiberbeta

Slide 39

Slide 39 text

www.beta.facebook.com

Slide 40

Slide 40 text

How can I prove if it is React Fiber or Stack?

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

How to 1. Join https://facebook.com/groups/reactfiberbeta 2. Visit https://www.beta.facebook.com

Slide 43

Slide 43 text

Useful resouces • Things: github.com/koba04/react-fiber-resources • Beta: facebook.com/groups/reactfiberbeta • Chat: https://m.me/g/Abas8IcWxIvjVxHN • Tests: isfiberreadyyet.com • News: Follow GH issues & PRs (using “fiber” filter)

Slide 44

Slide 44 text

Thank you! @glnnrys