70: Andrew Clark on Concurrent Mode
Today we kick off our first of 6 React Conf interviews.
We start with Andrew Clark to learn what this React Conf 2019 means for us — our libraries and apps.
He's a core team member who cut his React teeth on the fiber re-write and he's been deep in Concurrent React for 3 years.
We chat about future features, prerelease channels, and how Suspense is preparing the way for others to bring cooperative concurrency to their libraries, applications, and frameworks.
Featuring
Links
- 6: Async React with Andrew Clark — Andrew on React Podcast in 2018
- 27: React Today and Tomorrow with the React Core Team — Our interview with the React Core team in 2018
- Sebastian Markbåge — React Core Team Lead
- React Fiber rewrite
- React 16 APIs
- Preparing for the Future with React Prereleases — on the React Blog
- Introducing Concurrent Mode (Experimental) — docs on Concurrent Mode
- Concurrent Mode API Reference
- scheduler
- Andrew Clark: React Suspense — at Zeit Day 2018
- Building The New Facebook With React and Relay | Ashley Watkins — Introduction to Progressive and Selective Hydration at Facebook
- Data Fetching With Suspense In Relay | Joe Savona — Progressive and Selective Hydration at Facebook using Relay
Sponsors
G2i
G2i is a hiring platform for remote developers devoted exclusively to React and React Native. We vet, you get hired. g2i.co
Clubhouse
Clubhouse (now Shortcut) is project management that brings everyone, on every team, together. shortcut.com
Transcript
[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. Today we kick off our first of 6 React Conf interviews. We start with Andrew Clark to learn what this React Conf 2019 means for us, our libraries, and our apps. He's a core team member who cut his React teeth on the Fiber rewrite, and he's been deep in concurrent React for three We chat about future features, pre-release channels, and how Suspense is preparing the way for others to bring cooperative concurrency to their libraries, applications, and frameworks. This week is made possible by G2i and Clubhouse. As a React contractor, do you find it difficult to coordinate your development work and the work of finding new business? For me, I hated interrupting a good code bender to take a sales call and send invoices. I just wanted to do the work. G2i makes this possible. They market you and your skills directly to companies. They manage all logistics, contracts, invoicing, and payments. You get personal support from their incredible team. And best of all, you join a unique collective of incredible React and React Native developers available in Slack to help you through those really tricky moments. So growing your skills is integrated into a day's work. If you're a contractor, don't go it alone. Partner with the amazing people at G2i. Visit g2i.co today, apply, and find opportunities you'll love. G2i. We vet, you get hired. It's that simple. Let's talk about Clubhouse. If you work on a team like mine, chances are your project management pipeline is confusing. Developers prefer tracking progress in GitHub. Managers have discussions in Basecamp, and third-party services like Zapier send notifications to Trello and Slack. To keep other teams abreast of changes, not terribly integrated. This is where Clubhouse comes in and really shines. Clubhouse is project management that brings everyone on every team together. They know design, front-end, back-end, marketing, and management all have different project pipelines, and they give you the tools to manage all of them. Tools for both structured and unstructured workflows that are friendly, fast, have great user experience, and come with all the integrations you expect and need. Clubhouse has recently made all core features completely free for teams with up to 10 users. And right now, React Podcast listeners get 2 months free on any plan. Give it a try. I certainly am at clubhouse.io/react. Andrew Clark, welcome back to React Podcast.
[00:03:05] Andrew Clark: Thank you very much for having me.
[00:03:07] Michael Chan: So this is the first time that I've had you on the show. I think Michael Jackson had you on earlier.
[00:03:12] Andrew Clark: I think I was- last year we had at ReactCon, you were- no, wait. Yeah, I was Michael Jackson.
[00:03:17] Michael Chan: Yeah, yeah, yeah, we did all of you all at once, and that was super fun.
[00:03:21] Andrew Clark: Yeah, okay. Yeah, that was cool. It was like in a panel or like around the table or something like that.
[00:03:26] Michael Chan: I think he had you on like super early, like episode 2 or something like that.
[00:03:30] Andrew Clark: Yes, that's right. Yes. Okay, so this is my third appearance, I suppose, altogether.
[00:03:34] Michael Chan: And I think you might have even been talking about concurrent mode-
[00:03:37] Andrew Clark: Probably.
[00:03:38] Michael Chan: Back then.
[00:03:39] Andrew Clark: Yeah, likely.
[00:03:41] Michael Chan: How long have you been working on it?
[00:03:42] Andrew Clark: Um, in a sense, like the whole time I've been at Facebook, so, and even before. So I've been at Facebook a little over 3 years, on the React core team at Facebook for a little over 3 years. And it's really the original kind of in that I had onto the into contributing to React. So even beyond my involvement in it, uh you know, the ideas, the stuff that goes into Concurrent Mode and Suspense, um, goes back like, you know, 5 years probably. Yeah. Probably like, you know, uh, to right after the initial React release, maybe before. So there are a lot of prototypes back in the day, um, uh, by Jordan Walk, um, and I think Pete Hunt and several other people had these ideas for, you know, what if we had, you know, what about, what if React but like Concurrent and parallel, and we were like taking advantage of different threads and stuff like that. Uh there used to be a tweet that I would include uh in my slides when I would when I would talk about React, I think from Pete Hunt saying in like 2015, like, oh, wait for React 2. We're working on it now, it's gonna be great, it's gonna be concurrent, massively concurrent and amazing. And uh that spirit of optimism has kind of existed uh throughout our, you know, and sustained us for these many years. Um so I come into the picture around 2015, 2016, um, Sebastian, uh, who is our uh tech lead, he took some of, you know, he's been thinking about this very thoughtfully for a while. He took some of the ideas that was in, um, the ideas that were in Jordan's prototype, a few ideas from, you know, people trying to put things in like workers and stuff like that, uh, and kind of came up with this new architecture called React Fiber. Um, so React Fiber is the uh kind of rewrite of React that we, a new architecture of React that we shipped in React 16, uh, 2 years ago. And I was just a person in the React I was involved in projects like Redux and a few other things, and I just was a- I liked React a lot, so I was constantly stalking the GitHub commit list and like reading all the things that were happening just so I can get a jump on what might be coming down the pipe. And so I started seeing these commits about Fiber, and I reached out to Sebastien, like, oh, this is really cool, like, is there any way I could contribute? What about this, what about that? And Sebastien was very encouraging to me, and for some reason, kind of helped me out and helped onboard me and I started submitting PRs. My first ever kind of significant contribution to the React codebase was I implemented setState for for the new Fiber architecture. No way. Yeah, so pretty cool first PR.
[00:06:17] Michael Chan: Yeah.
[00:06:18] Andrew Clark: I count my blessings that I was in the right place at the right time, 'cause not everyone can say that they implemented setState.
[00:06:24] Michael Chan: Everyone's, React's most misunderstood method.
[00:06:28] Andrew Clark: Yeah, yeah. So that was really exciting. And I just- timing-wise, it could not have been more perfect for me to start contributing because, I mean, I got to write the the current iteration, the current implementation of React, um, from basically the beginning. Like, Sebastian did the first few, um, the the initial architecture and the first few commits, and then from that first setState PR, I just went on from there. Anyway, this is a- I give very rambling answers. No, no, no, you can edit all of this out later.
[00:06:57] Michael Chan: Well, it seems like, um, I had not really thought about it, but I think it's easy to forget, you know, because it all worked so seamlessly for those of us who use React, the public API of React. But it's easy to forget that this was a full rewrite.
[00:07:11] Andrew Clark: Yeah, I mean, except for- I will say, like, we reused the event system and the DOM stuff, but in terms of the, the core reconciler, I guess is what we call it, um, that is the part that is shared across React Native and React. And like React 360, and uh that's our VR uh platform. That is, that was totally rewritten, um from scratch, uh which is an amazing way to onboard yourself onto a new codebase, which is just write a new one. It's a new idea. And to write something, you're not just rewriting like, you're rewriting something that millions of people depend on. Yeah. Um, and I mean, that's a whole other conversation. Um, but, and what was your your original question was uh concurrent mode. Um. Yeah, so the reason I bring up this Fiber rewrite is that that Fiber rewrite was, you know, arguably the main motivation for that. There are a lot of other ones, but one of the main motivations for it was to support this new uh concurrent rendering paradigm architecture that we um are now starting to see the the fruits of that labor.
[00:08:12] Michael Chan: So you're so you're rebuilding React within these Fibers, and the goal of the goal of the rewrite is not just to like rewrite it to have like a cleaner codebase or whatever, but to support the the idea, the eventual idea of a concurrent mode in React.
[00:08:27] Andrew Clark: Absolutely, yeah. I mean, to be clear, the benefits of the new codebase on their own would have been worth it. Sure. Uh, I didn't quite see that at the time, but like when we released React 16, which was the first Fiber, you know, that didn't have any concurrent mode stuff in it. Yeah. But it was, you know, it did have some new features that had like fragments and portals. And um, so to be clear, there's a lot of benefits aside from the concurrent mode stuff, but yet the the whole point of Fiber was to get where we are now. Like, you know, 3 years ago we were working on Fiber so that we could get to today where we're finally releasing, um, to everyone, uh, the features that are, that are the fruits of that labor.
[00:09:01] Michael Chan: It takes a tremendous amount of vision. Um, has it been— uh, this might be getting like too nitty-gritty— but has it been frustrating at times? Like, you know, you have this, this vision for like what the future of React looks like, you know, and, and it turns out that it's it's about 3 to 5, maybe 6 years out. Um, has it been frustrating, like, as you got feedback from the community of like, like, oh, why are you changing this or that or the other thing? You're like, it's this thing in our minds that we're-
[00:09:29] Andrew Clark: Yeah, uh, frustrating's maybe the wrong word. Uh, I think I, especially because I was- I mean, this is only my second ever engineering job, uh, maybe second and a half. Um, so I think I was just a little naive, uh, in my enthusiasm and excitement. It's kind of like that, that tweet I was mentioning. It's like, oh, we'll ship it like in a few months, it's gonna be great. Um, but frustrating is the wrong word because uh it's not like we hit a roadblock and then it just like set us back several months and then we like kept trying and failing, kept trying and failing. We were making, every every failure was a lesson, of course. You know, we were making iterative progress. We were even, I always have to remind myself, we even shipped a lot of stuff along the way. Like we shipped React 16, which had error boundaries, which uh it had fragments, it had um Eventually we shipped a new- Portals. Yeah, portals. Later we shipped the new uh Context API. That, I mean, even that, you know, we had an old Context API, but even that feature was very much came out of, uh we need a version of this feature that actually works in that actually works, period. Um, you know, Hooks, I mean, Hooks was entirely, not entirely, but like, that was very much uh a concurrent rendering driven design. It was all about like how can we get people to write more idiomatic code so that when eventually we move to this concurrent paradigm, uh it's they're already writing code in the patterns that we need them to. Uh and doesn't have uh quite so many pitfalls the way that uh classes can sometimes have. Sure. Um so really, this is the way I've been trying to pitch it to to people that I talk to, like really everything we've worked on in the last 3 years has either been towards a goal of shipping um concurrent mode and Suspense to everyone, or it's been built on top of that progress. Um like to me, concurrent is, I I want everyone to know it, it's not like some special add-on. It's not like a layer on top of React, it is React. Yeah. And everything else is layered on top of it. Um it just so happens that it's it's uh it's taken us a few years to get to a point where we're confident enough, um that the uh both that it's good and that it's it's uh solves people's problems and that they will have the tools and uh ability to actually use this in their apps in a way that they understand, in a way that works on their team.
[00:11:45] Michael Chan: Nice. Now, a couple of things that we, we didn't talk about in that 16 release, which is very like wide release, is that in addition to hooks, last year you made an API for React.lazy and um also the original, the, the initial Suspense component. Yes. Which you have to use in, in order to use uh uh React.lazy. So I know that sometimes these, these concepts get munged together, you know, Suspense and Concurrent and all that kind of stuff. What is the- as we move forward, as we now have these, um, you know, experimental releases and people start playing with Concurrent Mode in their apps, um, what are some of those things? What are some of the components they'll be using? What are some of the, like, mindset shifts that they'll have to keep in mind? What's some of the What's the new stuff that that they need to think about that isn't just like Suspense, the component?
[00:12:37] Andrew Clark: Right. Um, so yeah, to just to fill in everyone, the Suspense component is a component we released uh last year, and it it works today. Um, you can use it in today's app, even though we haven't uh shipped concurrent mode to everyone. Um, and it has some of the characteristics, some of the features that full-blown concurrent Suspense has. Um, and the idea was just to give, just start incrementally giving people a way to get used to this new uh paradigm without even before the whole thing is is available. So Suspense allows you to wrap like a subtree in uh in this boundary so that if anything inside of it uh doesn't have the data or the code or whatever that it needs to render, then React will instead find the nearest boundary and render a placeholder instead. And so that's a very uh that's an integral part of how Suspense works in the concurrent world as well. Um in the concurrent world, you just have even more features on top of that. Um, you are able to wait a little bit before you show that spinner. Um, you're able to tra- uh, to coordinate when you when you make a transition. You're able to coordinate, you know, uh, exactly how long you're willing to wait for that transition to finish before you really need to show those placeholders. Um, you're able to say like, oh, this boundary here, um, it's I'd really prefer not to show this one if I can avoid if I can avoid it. So you're able, there's a notion of some uh boundaries are a little bit more embarrassing than the other ones, so if you can do a little bit to like show this one instead. Um, there's a lot of concepts wrapped up uh into Suspense that are available in the concurrent world that are not available in the synchronous world. So that's why the API already exists, but we still kind of sometimes talk about it in the present or future tense.
[00:14:16] Michael Chan: Interesting. So that is it. So Suspense as a component is one that kind of uh exists in both worlds. Yes. And uh but has is more capable in concurrent.
[00:14:27] Andrew Clark: Yes, exactly. Yes. Um so we can give you some of the benefits uh in this legacy mode that uh exists today, but you're really gonna unlock the full spectrum of possibilities once uh you're in concurrent mode. I think there's another question that you asked me.
[00:14:39] Michael Chan: Oh, so I guess uh I guess a follow-up to that is like just like how, what type, what are the new like components, I guess, um that are part of this?
[00:14:49] Andrew Clark: So um So uh there's there's a few new APIs, like uh I would encourage you just to go and read the docs, 'cause I might forget one of them, or they're they're they're pretty complex.
[00:14:59] Michael Chan: And where are those now? It's like reactjs.org/concurrent?
[00:15:02] Andrew Clark: Yeah, so uh reactjs.org/concurrent, um there's a very in-depth uh walkthrough, uh and there's an API reference. We're gonna there we're gonna keep iterating on it, it's not uh completely set in stone right now. Um we can discuss in a bit maybe the the implications of what we mean when we say it's experimental. But uh there are a few new APIs. There's a thing called Suspense.List, which is very exciting. And this is a way to coordinate um not just a single subtree, but if you have like a list or a grid uh of uh a grid-type UI, which is or list-type UI, which is you know very pop common.
[00:15:35] Michael Chan: Like a like a timeline.
[00:15:36] Andrew Clark: Yeah, exactly. Um it gives you uh it's like a primitive for coordinating when those things pop in and in what order and what sequence. We have some new hooks, one's called useDeferredValue, one's called useTransition. Those are ways that you can, well, useDeferredValue is a way that you can tell React, hey, this value here, this that I have in my the body of my function component, this one, it's okay if you wait a little bit longer for that one to show up. Oh, I see. And it allows you to not block the stuff that's more important, like for instance, changing the color of some button when you hover over it. So that's another concept of concurrent concurrent mode, and Suspense has is this idea of different things are have different levels of relative priority.
[00:16:19] Michael Chan: Okay.
[00:16:20] Andrew Clark: Um, uh, so imagine you, uh, you know, are switching tabs, uh, or you're navigating to a new page or a new part of your your app. Some, uh, there's multiple stages of of what goes into a a pleasant interaction when you transition throughout an app. We like to think of this sometimes as like splitting it into multiple paints, right? So the the the first thing you want to do when you transition to a new part of the app is you want to give the user at least some immediate feedback that they actually did click on something, or they actually did press on something.
[00:16:52] Michael Chan: Yeah.
[00:16:52] Andrew Clark: Um, so that's, that's really important, and that's like your first paint. That needs to happen basically instantaneously, as fast as we possibly can. So that's really important. We call that like a user blocking update.
[00:17:02] Michael Chan: In the, in the case of some of the demos that we might have seen, like uh going back to the, um, the JSConf Iceland um demo um that Dan did, would that be like the spinner in the button type of thing? Is that the-
[00:17:16] Andrew Clark: Yes. So uh so that uh usually we I would refer to that as maybe like a second paint, because you don't need to show a spinner in the button immediately, right? Like, as long as the button like maybe changes color, or you just have some feedback that the the the computer hasn't stalled, or the app hasn't frozen. You you want some like, uh you know, you know, on like your phone or iOS or Android, like you you tap on something and like- It's a little wave, a little ripple. Yeah, you you get like a highlight or it changes color, you just need some instant Uh, so that's the First Paint, very important. We we do that at user blocking priority and we try and keep that as small as possible. We want to we want to render re-render the whole page during that um during that render because like I really don't want to I can't slow down.
[00:17:58] Michael Chan: Yep.
[00:17:58] Andrew Clark: Uh, that immediate feedback. So uh we keep that really small and we move most things into one of the second like the second or third paint. Uh and that's the stuff that might depend on data. It might depend on loading new code, it might depend on new images. Often you're you're mounting entirely new subtrees. That just naturally is gonna take a little longer, especially if you're waiting on data, right? Um and our research at Facebook, and if uh you look into like uh research, UX research, a lot of that shows that there's actually a pretty large threshold that people are willing to wait for that transition to finish, as long as you give them that immediate feedback.
[00:18:37] Michael Chan: Okay.
[00:18:37] Andrew Clark: Um and Suspense, all of our APIs uh around Concurment and Suspense are designed to optimize for this, this pattern of splitting things into multiple paints. There's another kind of paint which you were just talking about, which is sometimes comes in the middle, and that's that little inline spinner that you might see sometimes when you when you click on a button and something has taken maybe a little longer than we had hoped. Yeah. Um, and it's it's we call that sometimes a busy spinner. And this is like just a reassuring- I think of it as like a reassuring uh signal to the user, like, I know that you clicked on me, or I know that you I know that you asked for something, uh like a second ago or whatever, and I know it hasn't I know it hasn't arrived yet, but we're working on it.
[00:19:15] Michael Chan: That first human timeout, like if you would have like that that like attention timeout where you're like, wait, what the heck? And that's when you would see like the secondary paint, which is like that little spinner in the view that you already have.
[00:19:26] Andrew Clark: Yeah, we've been calling that that a busy spinner. It's like, we're we're still working. We're still working on it. Uh please be a little patient and And uh research shows that if you show someone that, it extends even a little bit further how long they're willing to wait, because they they don't have to wonder if the thing just broke. Right? You ever have that experience where you're using something and you tap on it and you're like, it is taking a while, and you're like, is it actually working or do I need to like refresh, do I need to turn my computer off and back on? Um so we call this a busy spinner. Um and then finally, like the last paint that you'll get, the last frame that you see is when the transition is actually finished. I see. And uh so so that's the progression. There's immediate feedback. If it takes a little bit too long, maybe show a busy spinner, and then finally whatever the final result was. And Suspense is about giving you the tools to manage those transitions. So I mentioned one already is useDeferredValue. That's the hook. You pass it a value, it gives you back a deferred version of that value. Okay. And that allows you to say, hey, this thing that I just gave you, uh it doesn't need to be part of that first paint. Interesting. If this changes, I I don't need to show it immediately. And in fact, if you did show it try and show it immediately, it would probably end up slowing down that immediate feedback that I was trying to get. Um so that's what useDeferredValue is for.
[00:20:44] Michael Chan: So it's a way to like deprioritize your intention.
[00:20:46] Andrew Clark: Exactly, yes, exactly. Um and we have some like uh feedback and some warnings that will try and nudge you in the right direction if uh you start uh putting too much stuff into that first paint that I was talking about, the user blocking one. Uh we have some suggestions to say, hey, maybe put this inside of useDeferredValue, 'cause the heuristic we use is if you if you suspend on a uh on a value at user blocking priority, it's like, you know, you're probably not gonna be able to load over the network some data in the time that it takes that that you need to be able to show that button changing color. Right. And then we have another hook called useTransition, and this is uh a way that you can— uh it gives you a thing called startTransition, It returns startTransition method, and uh you pass it a function. Inside that function, you can schedule some updates, uh and those updates will also be deferred, similar to useDeferredValue. Um but it also gives you a way to configure how long you're willing to wait before you need to show that final paint, and the transition just needs to uh to actually complete. Um.
[00:21:52] Michael Chan: Interesting.
[00:21:53] Andrew Clark: In the future, we have some more unstable uh uh options that you can pass to useTransition that allow you to configure um when that busy spinner shows up, for instance. Okay. Those are still a little bit more in flux. Um, but the idea of this useTransition hook is it gives you um kind of the knobs that you can fiddle with to say, uh you know, this is how long- this is how I want to design my loading experience, how I want to design the paints that happen in this in this user interaction. So that's called useTransition.
[00:22:21] Michael Chan: Now, is this- for people who have been following along, is useTransition kind of the successor to what used to be maxDuration?
[00:22:30] Andrew Clark: Uh, yes, in some ways. So maxDuration, um, is uh this is an example of something that we had the idea for originally, and something we eventually realized in in practice is not a great primitive for coordinating and orchestrating these different um loading states and transitions. Um, so this is uh this useTransition hook is one of the things that we uh have that fits a similar um use case as what we were hoping that maxDuration would solve. So uh it gives uh useTransition, one of the options it has is timeout. Um and you give this uh number of milliseconds that you think that the user, or that you think that you're willing to wait before you really just need to show the next screen.
[00:23:12] Michael Chan: Oh, sure.
[00:23:12] Andrew Clark: Right? And to clarify, to fill fill in some context, uh when I say show the next screen, there might be some holes in the next screen, there might be some placeholders. And the idea of useTransition is, sometimes it's better to wait on the previous screen for the, for the next screen to fill in before you show it. But at a certain point, you just need to say, okay, it doesn't matter how much- it doesn't matter how much is still there. I need to, I need to show them the next screen, even if there's some placeholders. So that's what timeout.ms, uh, is the name of the prop, is a timeout value. That's what that allows you to configure is like, you know what, wait 2 seconds, and then after 2 seconds go by, just show me the next screen. Yeah. Even if there's a placeholder, just, I need to see something. Um, so recap, recap again, user blocking update that gives immediate feedback, possibly a busy spinner or something takes a little bit too long. And then, uh, a timeout where eventually it's just like, I need to show the next screen. The transition needs to go through.
[00:24:05] Michael Chan: It sounds to me like a lot of this is happening. I don't know. It seems like where a lot of frameworks have kind of like stagnated on like making the best like developer experience or like developer-focused APIs. A lot of what you're working on now. Is actually about product, right? It's about user experiences. Like you're going like closer to the user, um and the opinions that you're are forming are based on like user research and like your experience building the the next version of Facebook. Um what is what is some of that experience that's kind of informing these these decisions?
[00:24:44] Andrew Clark: So yeah, this is, um you know, there there are some downsides to working on corporate OSS, um or some pros and cons, I would say. And I get asked about that a lot, and I have to say, I try and answer reflectively and honestly. Um, but for the most part, I, there's there are a ton of upsides that might not be obvious. I mean, there's there's some that are obvious, like we have lots of resources and we have scale, we have lots of users that, um, um, you know, we're building products that people actually use. But the biggest, um, the biggest benefit I would say is that we get to use When we ship a product, we don't only get to use uh uh our APIs to build actual things, we have to. Yeah. Um, the React 16 release that you were talking about, where we essentially rewrote- I mean, not essentially, we did rewrite all of React and ship it to everyone and there were no giant bugs or migration woes. That's the type of thing that like, it was absolutely required. That we had to do that for Facebook, but also I'm not sure we would have been able to if we didn't have just this the the giant number of developers and engineers and uh the infrastructure and the users at Facebook that allowed us to incrementally try and roll this giant re:RAID out, find the problems, fix them, find the problems, fix them, um so that we were eventually able to release this to the entire world. And by the time everyone else was using it, the problems were already solved in our little mini- our little mini community at Facebook. Yeah. So yeah, working with the product teams and the infrastructure teams at Facebook, there's just absolutely no way that React would be in the place that it is today and be as good as we think it is for solving real-world problems if we weren't actually solving real-world problems as part of our everyday job at Facebook. We actually- some people don't know this, but the React team, the core team at Facebook, is in the product org. Hmm. We work directly with the teams that are building the new Facebook website. React Native works directly with the teams that uh the teams that are building Marketplace. And we get so much valuable feedback, direct feedback, uh and our APIs are so and our features are so influenced um by the response we get from them. Uh the the thing I was mentioning earlier about max duration not really working out, like there was an experiment that that didn't quite work in practice even though we thought it would work in theory. That was, I mean, the way we found that out was we tried we tried to ship it to the new Facebook website and the engineers were like, this is this isn't working how I thought it would. Like, it doesn't actually let me do this. Like, I don't I'm I'm not sure how this is supposed to work. We're like, yeah, yeah, you're right. And that's the type of thing, like, if we didn't have uh you know a a a a project like the new Facebook website, Um, we would probably have to either find some external open source partner, or, I mean, we would have maybe released that, that max duration prop to the whole world, and then we would- at this conference this year, we would be doing a bunch of backpedaling and trying to like migrate everyone off of it and onto a new thing. And, uh, so there's there's definite, um, benefits to us having like a little laboratory. Yeah. You know, just this tiny little tiny little laboratory of a billion people to be able to, you know, iterate and try things out before we're confident enough to uh share them with everyone else.
[00:28:15] Michael Chan: Yeah, you get the- I was, I was talking with Sunil yesterday, and it it seems like those who use React and are trying to get those same benefits of, you know, a really pleasant user experience really get the benefit of Facebook scale and uh research in this regard. And that's something that a lot of of like a lot of other frameworks really don't have access to like that, touching like a, you know, billion people on, on a release of like something.
[00:28:45] Andrew Clark: Well, I wouldn't say none. Like, I mean, Angular, uh, I'm sure they work really closely with Google folks. Um, I'm pretty sure Ember works very closely with people at LinkedIn. So I won't say we're novel in that regard, but, um, I, I also am just a huge fan of the Facebook engineering culture. You know, uh, Tom said today It's kind of his one of his mantras uh at Facebook, which is we need to find an incremental path from where we are to where we want to go. And that's really the story of Concurrent Mode. It's like we we're uh in this space where we have React and it's beloved by a lot of people and as people rely on it for their businesses and their products. And we have this future version of React that we think is even better, is even more amazing. How do we get everyone that is already using it to that place. And I mean, that, that is just ingrained into every fiber of- fiber, that was absolutely unintentional- of, um, of the Facebook engineering culture. And that, that's what allows- React would be very different if, if, uh, we didn't have that.
[00:29:45] Michael Chan: Yeah. Now you've mentioned, um, you've mentioned partnerships with, um, with Google, that you and, um, the Chrome team are really working on on figuring out what some of these next APIs that the browsers need to have. And a lot of that work, we haven't talked about this yet, but a lot of that came out of um Scheduler, which is this, this package that is kind of like, kind of pulled out of this, the rewrite of React and something that I assume Concurrent Mode relies on heavily.
[00:30:15] Andrew Clark: Yeah. So, um, for some context, Scheduler is, it's, this is like even more experimental than the other experimental stuff. Uh, but, uh, it is something that we actually already ship a version this package to everyone as one of the uh dependencies of React right now. Uh it's used for, just fun trivia fact, it's used to schedule um all all the the stuff that you put in useEffect. Okay. That doesn't happen, that happens after React paints to the browser. Um uh what we do is we, uh when you do an update, we, uh you know, first we call your component and we figure out, we reconcile, we figure out what we need to render to the screen. Once we figure all that out, we actually mutate the DOM, and then we yield to the browser to allow it to paint. And it's only after the browser has been allowed to paint to the screen and show the user the the new frame, it's only after that do we fire all of the useEffect stuff, all the stuff you put inside of useEffect. Sometimes we refer that to as a passive effect because it doesn't block uh the main thread. Um this is kind of a detour, but we use Scheduler for that already today. Gotcha. But really what Scheduler is designed for is uh it is our package for our uh library for um managing the different priority levels of of different work that React has to do. So to get boring and technical for a second, um I guess technical is what people want on this podcast. It's good. Uh uh you know JS is— uh the web is a single-threaded environment um for the most part. There's some stuff that happens on other threads, but if you're writing JavaScript, it all happens on a single thread. Another caveat, there's workers, yes, but for the most part, everything happens on a single thread. So all of your all of the React work that we do, the reconciliation, uh all of your React render methods, um they have to coexist on the same CPU thread as events that uh that get dispatched when a user touches something or clicks something. They have to coexist with, um you know, requestAnimationFrame. Um so we don't actually have proper real threads for the most part when you're running your JavaScript. So sometimes when we use the word "concurrent React," we're like, okay, what's that mean then? Like, there's only one thread, you can't be concurrent on a single thread. Um, so this is uh the computer science term for this is cooperative concurrency. So that's the kind of concurrency that React on the web— uh React Native is a little bit different— but uh React on the web uses cooperative multitasking, cooperative concurrency, and allows us to have conceptual threads Um, different lanes of work that we can be working on at any time and switch between them as new events come in. Um, so the basic idea behind this is, uh, in React today, when you, you know, let's just say you you render the whole screen when you first load the page, that can be a lot of work. This could be a lot of components that you have to call the render methods, you have to diff all those things, you have to reconcile all that stuff. That can block the main thread for like Yeah, sure. So that means for n number of seconds, you can't do anything. You can't interact, because that again, that's also on the main thread. You can't uh be animating anything uh with requestAnimationFrame, because that's on the main thread. Um, you're just blocked for the as long as it takes for React to render that update. Um, so the big thing, one of the big features of concurrent mode is uh we no longer block events. Even if you have a second, 2 seconds worth of work, um we no longer have to block events, even though we're still running on the main thread. And the trick we have for that is we uh we just split the work into chunks. So all the chunks happen on the main thread, but there are little tiny spaces in between all of the chunks. Yeah. And if there's no event, then the space is like infinitesimal and it's not a big deal. But if there is an event that's pending, the browser can come in, dispatch the event, we can get it, uh, React can be notified that there was a new update, and that allows us to, uh, if it's higher priority than what we were currently working on, switch to doing that instead. So that's the, the, sometimes we call this time slicing. Like we have this giant task and we're just slicing it into chunks and spreading it across different, uh, along the timeline.
[00:34:21] Michael Chan: So the schedule is kind of like a triage system almost?
[00:34:24] Andrew Clark: Yeah, I mean, it's a scheduler. Yeah, yeah. Um, but yeah, so it's the thing that manages like whether, um, It's the thing that allows us to split work into chunks. So the API is not final. Also, I should mention at this point, it's uh very much based on our collaboration with the Google Chrome team. Uh we have a user space scheduler that we're using. Uh the plan eventually is to rely on a native browser API, platform API that we are— um there's a proposal out there. I think if you go to— github.com/WICG/mainthread-scheduling. You can see the proposal. If that's the wrong URL, just Google main thread scheduling and it'll come up.
[00:35:02] Michael Chan: We can we can find it for the the show notes.
[00:35:05] Andrew Clark: Yeah, yeah. Um, and uh it's heavily based on kind of that evolving proposal. It's it's still a work in progress. Um, so I'm gonna I might mention some APIs that don't that won't exactly line up with what eventually ships. But essentially, uh our user space scheduler that we built um gives you a way to schedule a task And it gives you a way to cancel a task, and it gives you a way to specify the priority of that task. So whether it's user blocking, like I was mentioning earlier, or just like one of those default tasks that that that is the default. And then it also gives you a way to check if you need to yield to uh execution to the main thread and pick up later. So the way this usually works is in the framework that you have that is using Scheduler, you'll have a task loop, essentially, a work loop, where you'll do a unit of work. Maybe it's popping something off a queue and performing it. And then each in between each unit of work, you'll check this method that- let's just call it should yield. And for as long as this method called should yield returns false, just keep doing work. Just keep doing it.
[00:36:13] Michael Chan: Okay.
[00:36:14] Andrew Clark: Over and over and over again. Until either your queue is empty or until shouldYield starts returning true. And that's what tells you, hey, you know, there's uh either an animation or there's some user event that is on the main thread. You really need to give up control of the main thread so that that thing can be unblocked, and then um you can post a continuation so it'll pick up later. So that's the um essential, essential primitive that allows the Fiber architecture to work. So we have workLoop, We do like a single unit of work, which for us is a component. We call that component's render method, we get its children back, and then uh you know we have like a depth-first traversal. But before we go down to the children and start rendering those, we check to see if we need to yield. If we need to yield, then we post- we schedule another task to come back later and we exit. If we don't need to yield, then we just keep going iteratively and on and on and on. On. Um, and uh, that's like the, that's the basic mechanism that allows us to have concurrency, quote unquote, even though there's still only a single thread. Um, there's, I'm I'm lighting over a lot of the nuance here, but that's that's that's the basics, um, the basics of it. Um, a lot of what just what determines like what goes into whether you need to yield or not is also uh the priority level. So there's, uh, the the big ones are just user blocking and default um uh clicks and any transition or any uh user interactions, React will automatically make those user blocking. Okay. Um and then the way that you uh opt out of that and make something default again, because that's what you want to do for most things that are like I/O bound or depend on data or that don't actually need to happen in that user blocking first paint that we were talking about. Um that's why we have those other APIs like useTransition and useDeferredValue, because those, those things are integrated with Scheduler as such that when you use them, it makes everything that happens as a result that default priority again.
[00:38:14] Michael Chan: Interesting. So are those APIs a way to not require you to use Scheduler directly?
[00:38:21] Andrew Clark: Yeah, that's, that's the idea. Um, eventually we- so the idea is that Scheduler is- our current thinking is it's mostly pitched towards other frameworks. It's not something that you would if you're a product developer, if you're building components, if you're building features in an app, you would probably not interact or like need to import Scheduler. Gotcha. Because um you know all of that chunking and all that complicated stuff I was just describing, like React does that for you. Like you don't have to set that up, React does. But if you're building a framework or working on a framework like maybe Webpack or I don't know like Apollo or Relay or something like that, You might you might want to use uh these primitives in your own library. You might want to time slice stuff. Um you might want to read what what is the current priority at which I'm running, um so I can make decisions about scheduling. Um yet the reason the scheduler package is so important is uh when it comes to scheduling, like you need some, especially particularly a cooperative scheduling, where it's really just up to everybody that's running code to not hog the main thread, right? Um You need some sort of central thing, coordinator, that is able to choose which task to work on and able to choose when the current task needs to yield and all that. So you need to agree on some set of things. And so the things that uh in this uh setup that we have, this architecture, the things that you have to agree on are use postTask to schedule tasks and uh use these priority levels, these 5 priority levels that we've laid out. To schedule your work properly. Um, and as long if you can assume everyone is being a good citizen, um, which sometimes is not the best assumption, but if we can get everyone to be— uh all the frameworks and React itself and the code that you write, um, in your components to be a good citizen, then everything will work out nicely.
[00:40:10] Michael Chan: Awesome. Awesome. So that's a way that you're working with the Chrome team, um, directly to get these scheduling APIs into the browser. Uh, I know that you mentioned earlier that you're also working with them and through frameworks to try to figure out how to handle the server-side, um, problem in React. Could you talk a little bit more to that?
[00:40:31] Andrew Clark: So React has had, uh, server-side rendering for a while. I mean, I guess for as long as I've been using React, uh, there's been some way to- I mean, this, I think this was actually the initial thing that got me really excited. What, you can render the same app on the server? I don't have to write it twice? And it was just mind-blowing to me that, yeah, like, uh, you could render to some HTML So we've had that for a long time, um, but uh it's it's it's cool, but um in practice there there's some flaws with it. Um, and so what we've seen is like a proliferation of a lot of other server renders that people have written, um, at Airbnb or just even ones that are open source to try and circumvent the problems that the just the out-of-the-box uh React server render has. Um, there are several, I won't list all of them, but one of them is just kind of you immediately hit once you try and do server rendering is, well, how do I load my data? Like, uh, you know, this gives me a way to like give it a component and then get a string back synchronously, essentially. But like, if my- if I don't know what data to load, then what, what do I do? Right. So people- there's a lot of ways to handle this, like have some framework that sits on top that like, uh, where you wait for all the data first before you start rendering. That's some version of that is essentially what you have to do. Um, I think-
[00:41:50] Michael Chan: I think Next has like getInitialProps or something like that.
[00:41:52] Andrew Clark: Yeah, Next has a way where you just declare, this is the stuff that I need to render, and you you do all of your, you know, initial fetching in that getInitialProps method, and then once it's done, Next knows that it can it can do the server rendering. Um, but really, like, if you if you, you know, step back and think about this, this is very similar to the problem space that Suspense was designed to involve, where it's like, I should be able to start rendering even before all my data has resolved. Yeah. Um, and uh, so we have some plans to build a a much better uh streaming server renderer that can render out of order, that has uh built-in support for Suspense. Um, it's very much based on the BigPipe architecture that we have at Facebook, which is how Facebook has been built, you know, for, you know, I don't know how many years at this point, 8 years? A long time. And it's very much inspired by that architecture, but it's uh it's a React it's a React architecture. I gave a talk about this, like a very early prototype of this concept, um last summer at Zeit Day, I believe.
[00:42:58] Michael Chan: Yeah.
[00:42:58] Andrew Clark: Um anyway, that that is uh very much on our roadmap. Um it's especially something we're investing in now because we're actually going to ship it to facebook.com. Whereas previously we weren't doing any server rendering on on the old Facebook website, 'cause it was not primarily a React-rendered website, it used to be PHP. So there is progress on this. Um the the piece we're working on right now is specifically the hydration. So this is the other part of server uh server-side rendering is, you know, you can send some HTML down to the client that you rendered on the server, and that's pretty cool. But you can't actually interact with any of that HTML, uh except for the native, you know, like form elements and stuff. Yeah. Actually interact with it or do anything with your app until React loads. Yep. And uh we call this hydration. React will load, it'll take the HTML that you already rendered, and it will attach all the event listeners and just start listening for updates, essentially. Um, that is, so so even if you have HTML, that that takes time. Like you gotta load all the code, you gotta you gotta actually do the work to to attach the event listeners. Uh and you know, that alone can take, let's just say a second again. Like it can take multiple seconds depending on what kind of device Yeah. So um before we build a server render, we're trying to make that problem a lot better. Like it's gonna be unacceptable for us to wait that long to start interacting with the app. So um we have a feature called selective hydration. Well, well, two things. Uh there's progressive hydration and selective hydration. So progressive hydration just gives us the ability to hydrate part of the app before we hydrate the entire thing. So that's quite nice. Um and uh it's the Suspense boundaries that uh that we already have for the client, it's those same boundaries that we use in order to chunk up the hydration work. It's like, okay, first we can render this level of boundaries, uh or sorry, we can hydrate this level of boundaries, and then we can hydrate the next level, and we don't have to do it all in one giant chunk.
[00:44:50] Michael Chan: Can you prioritize the independent boundaries?
[00:44:53] Andrew Clark: Um, well, so let me get to the second one. So the second feature we have is called selective hydration. Uh and so the idea behind this is Yes, some of the things that uh are more important to hydrate than others, and uh a really good way to decide what's most important is what did the user interact with. So the the idea here is if you um uh if the user interacts with some part of the tree that has not been hydrated yet, yeah, React can uh prioritize that subtree specifically uh and hydrate that before it continues doing everything else. And that uh like greatly uh decreases the time to in between when the user interacted and when they actually see some sort of response. Interesting. So that's called selective hydration. There's like a few other features in here, but this what really excites me about this feature in particular, but really all of our the features we're working on, is once you're using Suspense, that's base all that's basically free. You know, like, 'cause you're already you already have the Suspense boundaries. You don't have to dramatically change the way you write your code in order to take advantage of this selective hydration feature. You just, as long as you wrap some stuff in Suspense boundaries, which you're probably already doing anyway in a Suspense concurrent app, because that's how you do client-side Suspense stuff, then you just get that feature for free. So the demo that we, like the prototypes that we have internally, are super exciting for that reason, where it's like, we can turn this on on the new Facebook website, and it's like, we didn't have to go out and add a bunch of code anywhere, it just started working. Yeah, yeah. And yeah, to zoom out a bit, that's that's why all of these APIs really excite me. It's like they all fit together so well. Yeah. And uh once- there might be a little bit of a conceptual hurdle to understand what's going on, um or like how you're supposed to think about these different lanes of priorities and and all this stuff. There's a little bit of a conceptual hurdle, as there are with a lot of things in React, but then once you get over that hurdle and you've paid that initial cost, everything just becomes so intuitive and you just have so many, so many uh cool high-level tools to start designing uh the user experience.
[00:46:59] Michael Chan: I love that. I I I think also you've been saying this, and um Ashley was saying this uh in the in the talk this morning, uh this idea of Suspense boundaries. And I I I've heard like Suspense, right, is like a component, but this idea of Suspense boundaries, the idea that this is like a bounded piece of of Vue, right? And then you can think of that as like being able to like, you know, load um in different ways, right? To be able to manage the way that that loads makes a lot of sense, especially um coupled with the concept of like error boundaries, right? Because it's like this- something is going to raise up and then that is the bound that like actually like handles that. And that's really fascinating.
[00:47:37] Andrew Clark: Yeah. My uh flip- so my my flip kind of like line about this is that Suspense boundaries are like error exception handling with good marketing. I mean, it's a little bit more than that, but if you think about how like Suspense works, works today in just like the legacy uh mode, they're essentially error boundaries, right? Like I tried to render something, I failed because there wasn't enough data, so I rendered something else instead. It's exception handling. Uh what they added, uh like the the other novel bit, is that we do eventually swap back from the placeholder to the original view. Um so that part is is not just marketing. But um And
[00:48:17] Michael Chan: that is where it differs from like an error boundary, which is just
[00:48:21] Andrew Clark: Yeah, like once we show the error, then it's up to you to to you know manage the state to swap it back. So that that's one difference. But yeah, that that's a little bit uh glib, I suppose. Um but there's there's some truth in it, which is that one of the you know one of the feature, there's there's multiple parts to Suspense, but one of them is just like, I couldn't render this, so please render that. And it's uh the the other aspect is, it's like typed errors, right? Like it's it's not just we're gonna catch any bad thing that happens and render something else in response, it's like, this is specifically for loading data. Yes. If some data is not there, we're gonna render this instead. And by giving everyone like this common paradigm, this common pattern to follow, it allows us to orchestrate components written by many different authors across many different frameworks. It allows us to orchestrate it using the same set of primitive APIs. So like, you know, when sometimes, I mean, this is very common nowadays, you use some some uh third-party library or some, like, maybe the some other team at your company built this, this component and you want to use it as well. And the API is often like, maybe it's a hook and it returns you value, isLoading, and isError. And like, this is a common pattern, but it like shows up in a slightly different way and across a bunch of different things. And it's very- I think of it as like very ad hoc way to like handle errors and handle loading states. Yeah. What's nice about Suspense is is hopefully we'll never have to see that again. We'll never have to see like every single framework or every single library or component reinventing a special way to deal with loading, 'cause no, you'll just use the Suspense API. That's what allows things like Suspense.List to exist. So Suspense.List, to repeat from earlier, is a way to coordinate like a list of components that depend on data and like show the rows in order or out of order or um in different uh with different settings. That works with anything that uses Suspense.
[00:50:15] Michael Chan: Yeah.
[00:50:15] Andrew Clark: We don't need a special like Right. We don't need a special React Router integration. It's just as long as it knows how to integrate with Suspense, all of our Suspense features are just automatically gonna work. Um, so it allows us to, and it's uh hopefully like even beyond just making it easier for programmers, uh it allows people who are new to programming or maybe are just like like designers that are working on the design at that level, it gives them a language to start thinking about how that they want to design their loading screens and then and uh communicate with the developers, hey, there's a boundary here, there's a boundary there, I want this to come in in order, I want this to come in maybe a little bit later. It just starts to give people more uh common both design language and and development language.
[00:50:57] Michael Chan: Yeah, now, so so so you talked about this as a type, and I I I'm glad that you did, because I've I've been kind of referring to it as a type as well, but this this this object, I guess, that is going to either throw an error, throw a thenable, or like return a value. Mm-hmm. How do you- how do we refer to that? Because I know that there was this like kind of like React cache, kind of called that a resource. And-
[00:51:21] Andrew Clark: Yeah, so I think this might have been one of our mistakes in roll initially, the initial announcement, is we pro- we over-focused on those like details. Um, I don't- you mentioned like throwing a thenable or throwing a promise. Uh, I have myself stopped ever saying that because I think it's a distraction, like, um That's probably not- like, we were just talking about this yesterday, like, we probably should just change that API. Okay. Because that's not super important.
[00:51:47] Michael Chan: Sure.
[00:51:48] Andrew Clark: We're still discovering like how we think the best ways to write a Suspense integration are. We've learned some things in how- one of the things we've worked on over the last year that has informed our development of these APIs is we've integrated Suspense with Relay. Okay. Because that's what we used to build Facebook. And we have something that works really well now. Like, you can go out, I can't remember the URL, but if you go to like the Relay blog, we just announced an experimental release of Relay that works with all the APIs that we just released in uh in React in the experimental mode. But we we learned a lot from that collaboration. We have some future ideas for ways we can make it even better. Okay. But those aren't, that's part of the stuff is, that that right there is the reason why we're still calling this an experimental release. Sure. We still have a little bit more work to do in order to describe uh give proper advice to folks about how we think that they should integrate with their apps. And I'm hoping we can work really closely with Next.js and Gatsby and Apollo and all these other frameworks to, to make sure we're on the same page. But I wouldn't want to give a specific name to those things that you're referring to.
[00:52:52] Michael Chan: Yeah, I guess, um, but, but just to be, to be clear for people who want to experiment with this, is that it's not just like, it's not just catching like any, like anything that is raised up in that, like any promise or whatever that is unresolved in that component tree. It has to be wrapped, like in the same way that you use like React.lazy to wrap the import of a component.
[00:53:14] Andrew Clark: Yeah, the point I was trying to make about the, the comparing it to like a typed exception is just that it gives uh a common- it's like a, a common way for all of- a common pattern that all of these different frameworks can use. So they don't have to know about each other, they don't have to reinvent like their own special ad hoc system, but if they all just opt into Suspense Yep. Then these uh other higher level things that are provided by React will work. useDeferredValue will work. Yeah. useTransition is gonna work. Um the selective hydration is gonna work. SuspenseList is gonna work. And you don't have to have a special binding layer between that and all of the different frameworks that opt into Suspense.
[00:53:55] Michael Chan: Cool. Well, I'm super excited to see, um look at that Relay doc and see kind of how they're how they're doing it there and see what you come up with. Any, uh I guess, parting wisdom as people kind of explore these new exploratory features?
[00:54:09] Andrew Clark: Yeah, I just wanted I wanted to, um, like I think this is, um, one thing that has made me a little bit wary of today, I suppose, is I just know that the question people had going into this conference, um, and uh, even now is maybe like, still? Uh, what is what is what is today? Is today a big milestone or is today just another check-in from the React team? That, you know, I I watched a talk that Andrew gave like 3 years ago and it was about the same stuff. Why is he still talking about it? Why why aren't I using I'm seeing it already. Uh, and so first of all, I sympathize, empathize, I'm horrified for you at at our, uh, you know, dragging our feet a little bit. But uh, that's kind of why I I've been talking about, um, you know, I've I've been trying to really emphasize that like what we've been working on and what we've been progressing towards to give people a sense for, I I want them to be confident that these APIs we're working on are are not vaporware, essentially. So what is today? I think today is a really big milestone because today is the first time with this experimental release that we are announcing to the world that we are ready for you to start giving us feedback. Yeah. I think a few years ago we we had two wrong ideas. One of the wrong ideas was, oh, this is just gonna take a month. They're like, oh, you know, we released React 16, like in two months we can release the concurrent part of it, we'll just turn on the flag. That was the first wrong idea for all the reasons I've just laid out. It's actually a lot of work to get the whole, um, just even all of Facebook to the place where we can start taking advantage of these features properly even so that we know we have the right APIs. The second wrong idea we had was this notion that we could just eventually, all the pieces will be in place and we can just have this big bang release and everything will be perfect. Um, because that's that's generally how we like to do things. We like to only release them once we are very confident. I mean, I think that's mostly how what we did with Hooks. We felt very good about when we released Hooks, we were pretty sure that we had a uh we were releasing something good and that people would be confident in. With Concurrent Mode, it's just so- the concerns that we're dealing with, like the the problem space we're dealing with, is so cross-cutting. Yeah. It affects every single part of the React ecosystem, and we are really, really committed to making sure that that we're not leaving anyone behind and that we can move everyone over into this new paradigm without having to rewrite a bunch of their components and without having a bunch of frustration on day one when, oh no, you know, maybe maybe Apollo works, maybe Apollo's integrated with Suspense, or maybe I'm using Relay, so that's integrated with Suspense, but ah React Router's not. Yeah. Ah, I can't use it 'cause, you know, Gatsby doesn't support it yet, or like one of the N libraries that I'm using doesn't have integration. So what we've now realized is that we're in a place now where we think that the React primitives are a lot more solid. Like we're really uh confident in Suspense uh transition uh the Suspense list and useTransition, really confident in that, we're getting a lot more confident in the scheduler, even though the API isn't totally uh nailed down. But what we now what we need to do is we need to get all of our community partners to uh onto the same page. We need to share what we've learned with them, and the only way really to do that is to share with them the same uh builds of React that we've been using at Facebook. So that's what the experimental channel is all about. Um I wrote on the blog uh earlier this week announcing this experimental channel in anticipation of today when we when we say, hey, by the way, Concurrent Mode is in the experimental channel. And if you read that document, you can- it's very much designed to give people like a clear expectations of what they can expect when they run one of these builds. So our advice is uh the the experimental releases, they're published to npm. They are- we're gonna planning to ship them maybe even daily. I'll probably just set up like a cron job to ship them daily. They're running the exact same experiments that uh experimental APIs that we're shipping to many production users at Facebook. So in that sense, they're- I'm not gonna use the word stable because that has uh loaded connotations with SemVer, but fairly reliable. I mean, we can't break them entirely because we're using it to ship to Facebook. Sure. So what what I'll say is experimental, you can depend on them to not be completely borked releases, but just know that um that we're not conforming to SemVer on these releases. The versions are just nonsense versions that are hashes of their contents. And the reason we're doing that is just we're setting expectations like, look, React has a well-earned reputation for like stability. It's been 2 years since we've had uh a breaking change or a major release, and in the meantime we've like added hooks, we've added error boundaries, we've added a bunch of stuff. That we are committed to doing that going forward, we're gonna continue to be super stable. But at the same time, we want to we we don't want that to prevent us from sharing things ahead of time. Yes. So from now on, what I I'd really like to do, um, is instead of, uh, for every single feature, waiting for this big bang release and everything's perfect, um, start to share things with our community partners and people who are just interested in open source to try it out using this experimental channel. Uh, and we'll just set clear expectations about what's, what's, what you're capable of relying on and what, what might be a little bit more up in the air.
[00:59:20] Michael Chan: Awesome. I love it. I love it. I love the notion too, that, that there's a lot of, I guess, tension with this idea of like JavaScript fatigue, right? And like the worst kind is when you, you think you have something and then it gets taken away. Yeah, exactly. I really like this this focus on trying to really work out the boundaries of like what it what you want for concurrent mode and Suspense and and figuring that out in Facebook. And then kind of like once it feels about right, then exposing that um that now in a way that's going to feel less like, you know, herky-jerky back and forth and more like, hey, like we know this we know this actually works now. Yeah. Um so I'm really excited about that uh experimental
[01:00:00] Andrew Clark: Yeah, I mean, I have been excited to start sharing this stuff for, I mean, really 3 years. I've been like, I really want to see what Apollo does with this, I really want to see what Next does with this. And we don't withhold because we want to be stingy, we withhold because we don't want to give people something that we're not- that we can't be confident in. We don't want to give someone an API and then take it away the next day. We don't want to give people incomplete information or send them off on a wild goose chase, and it turns out like they put a bunch of effort into something that just fundamentally So uh that is that is what I think today represents, is we're saying we are confident in these APIs, um and we want you to help us, give give us feedback and help us get uh all of these projects on board so that when we release this to everyone, and every uh you know a person who's using React for the first time can uh install their the most popular libraries and be able to use it and not get super frustrated. So, uh, yeah, I'm really excited to get get this in everyone's hands and and and start to get bug reports and and feedback, uh just like we've already been doing internally at Facebook.
[01:01:04] Michael Chan: Awesome. Well, thank you so much, Andrew. I really appreciate your time today.
[01:01:07] Andrew Clark: Yeah, thanks. It's been it's been great. Have me back any any time you want.
[01:01:11] Michael Chan: Thanks, Andrew, for diligently working on Concurrent React and bringing us into such a promising future. To learn more about Concurrent React, visit the official docs at reactjs.org/concurrent. And while you're there, send Dan Abramov some love for his terrific work making the new concepts approachable. Thanks also to our sponsors, Clubhouse and G2i, for making this episode possible. Clubhouse has recently made all core features completely free for teams with up to 10 users. And right now, React Podcast listeners get 2 months free on any plan. Get your project back on track at clubhouse.io/react. Contractors, don't go it alone. Partner with the amazing people at G2i. Visit g2i.co today, apply, and find opportunities that are tailor-made for you. G2i. We vet. You get hired. It's that simple. This episode of React Podcast was edited by Mikael Delport. It was produced by Mikael Delport and Sarah Jackson. You can find React Podcast on Speck, a network to help designers and developers level up. Visit speck.fm to find other shows that will take you further in your career. Help us out by reviewing this show on iTunes. Your reviews help the show grow and help us ensure great guests and awesome content week to week. To join the discussion, visit reactpodcast.com/chat or follow us on Twitter @reactpodcast. I'm @chantastic. To stay out of the discussion but get updates, visit reactpodcast.com/news and sign up for emails. Thanks so much for giving us your attention. We'll be in your ears again next week.
chantastic.fm