From React Fiber to Async Rendering
from an application engineer perspective
🈚️ No code
📝 API not ready yet
🗣 Storytelling
React, React Native, React Fiber?? 🤔
Reconciler
(render/reconciliation)
Renderer
(commit)
props state
vDOM
DOM (UI)

⏱Scheduling
🚀Priority


Async Rendering 😏
Computing power
Network speed



Life without version control
hotfix 😦
Life with version control
Time Slicing 🥒
Computing power
Network speed
Time slicing 🥒
// component
componentDidMount () {
this.props.fetchData()
}
// redux
const fetchData =
state => state.merge({
isFetching: true
})
// saga
function * fetchData () {
yield call(api.fetchData)
// store data to redux
}
// component
render () {
isFetching
? renderSpinner()
: renderData()
}


Dependency
Loading state depends on UX
NOT how you code


// app.js
const App = () => (
<MovieList />
<MoviePage />
)
// moviePage.js
const MoviePage = () => (
<MovieDetails />
<MovieReviews />
)

<Placeholder
delayMs={1000}
fallback={<Spinner />}
>
<MoviePage>
</Placeholder>
Reasonable spinner

const MoviePage = () => (
<>
<MovieDetails />
<MovieReviews />
</>
)
Wait sibling

const MoviePage = () => (
<>
<MovieDetails />
<Placeholder
delayMs={2000}
>
<MovieReviews />
</Placeholder>
</>
)
Partial render
const moviePageFetcher = createFetcher(
() => import('./MoviePage')
)
const MoviePageWhenNeeded = () => {
const MoviePage = moviePageFetcher.read()
return <MoviePage {...props} />
}
// app
const App = () => (
<MovieList />
<MoviePageWhenNeeded />
)
Code splitting

Some blocker ...
😈
Suspense 🛑

Time slicing 🥒
Suspense 🛑
Computing power
Network speed
Async Rendering


How?
Feature branch
$ git checkout -b development-fiber


Feature flag
Test is important
Test is important
Test is important
⚛️ React core team
References
- https://reactjs.org/blog/2018/03/01/sneak-peek-beyond-react-16.html
- https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
- https://code.facebook.com/posts/1716776591680069/react-16-a-look-inside-an-api-compatible-rewrite-of-our-frontend-ui-library/
- https://www.youtube.com/watch?v=ZCuYPiUIONs
- https://dev.to/swyx/react-suspense-qa-28lc
- https://twitter.com/acdlite/status/977291318324948992
- https://twitter.com/dan_abramov/status/981712092611989509

React Fiber and Async Rendering
By Ivan Ha
React Fiber and Async Rendering
What the heck is Fiber and async rendering
- 241