Dan Abramov from our team just spoke at JSConf Iceland 2018 with a preview of some new features weâve been working on in React. The talk opens with a question: âWith vast differences in computing power and network speed, how do we deliver the best user experience for everyone?â
Hereâs the video courtesy of JSConf Iceland:
I think youâll enjoy the talk more if you stop reading here and just watch the video. If you donât have time to watch, a (very) brief summary follows.
About the Two Demos
On the first demo, Dan says: âWeâve built a generic way to ensure that high-priority updates donât get blocked by a low-priority update, called time slicing. If my device is fast enough, it feels almost like itâs synchronous; if my device is slow, the app still feels responsive. It adapts to the device thanks to the requestIdleCallback API. Notice that only the final state was displayed; the rendered screen is always consistent and we donât see visual artifacts of slow rendering causing a janky user experience.â
On the second demo, Dan explains: âWeâve built a generic way for components to suspend rendering while they load async data, which we call suspense. You can pause any state update until the data is ready, and you can add async loading to any component deep in the tree without plumbing all the props and state through your app and hoisting the logic. On a fast network, updates appear very fluid and instantaneous without a jarring cascade of spinners that appear and disappear. On a slow network, you can intentionally design which loading states the user should see and how granular or coarse they should be, instead of showing spinners based on how the code is written. The app stays responsive throughout.â
âImportantly, this is still the React you know. This is still the declarative component paradigm that you probably like about React.â
We canât wait to release these new async rendering features later this year. Follow this blog and @reactjs on Twitter for updates.