React Conf 2019 is right around the corner. Last year brought us Hooks. What will happen this year?
To be honest? I have no idea 😄 But I thought it’d be fun to look at the upcoming features that the React team has talked about publicly. Maybe we’ll see some announcements about them in a few weeks.
The two big things we’ve heard about are Concurrent Mode and Suspense for Data Fetching, and a recent post about the React roadmap suggests that those two features will be released at the same time. (you might say, concurrently)
With Concurrent Mode, React will gain the ability to work on multiple things simultaneously-ish. That means it could be midway through rendering a large list of items, put that work aside temporarily to handle some user input, and then pick up where it left off with the rendering.
In today’s non-concurrent React (“synchronous React”), rendering happens on the main thread. While a component function (or a class’s
render) is running, the browser waits for it to finish. If you click a button or type into an input while that render is happening, that event gets queued up until the render is done. It can lead to some laggyness if there’s a lot to render.
Andrew Clark gave a talk on Concurrent Rendering at React Conf 2018, and Concurrent mode is currently available as an “unstable” feature – definitely not ready for prime time in React 16.9.
Suspense for Data Fetching
You can actually use Suspense in React today (it’s been there since React 16.6!) but it’s really only useful in combination with
React.lazy, to display a loading spinner while a component is loaded in the background. That’s a great feature if you’re using code splitting, but Suspense doesn’t yet handle data fetching like in Dan Abramov’s JSConf Iceland demo.
In an upcoming version of React, Suspense will offer fine-grained control of when and where to display loading spinners (or other fallbacks) while data is being loaded.
SO WHEN CAN WE USE IT
According to the React roadmap post Concurrent Mode and Suspense for Data Fetching are expected to be ready this year. Facebook is already using the new features in production, which seems like a good sign. React Conf would be a logical time to announce it!
So I guess all that’s left now is to wait.
3 weeks to go…
Learning React can be a struggle — so many libraries and tools!
My advice? Ignore all of them :)
For a step-by-step approach, check out my Pure React workshop.
Learn to think in React
- 90+ screencast lessons
- Full transcripts and closed captions
- All the code from the lessons
- Developer interviews
Dave Ceddia’s Pure React is a work of enormous clarity and depth. Hats off. I'm a React trainer in London and would thoroughly recommend this to all front end devs wanting to upskill or consolidate.