chantastic.fm

1: React Native for web with Nicolas Gallagher

Episode 1 · January 29, 2018 · 00:35:06

Hosted by Michael Jackson · With Nicolas Gallagher

Download MP3 · Jump to transcript

Welcome to the inaugural episode of The React Podcast. In this episode Michael Jackson talks with Nicolas Gallagher about his project React Native for Web, the React Native API, how Twitter's new mobile website is powered by React Native for Web, and more.

Featuring

Links

Transcript

[00:00:06] Michael Jackson: This episode of the React Podcast is brought to you by ReactTraining.com. In-person, hands-on training for development teams from React community leaders and experts. Visit ReactTraining.com to learn more. Okay, everybody. Welcome to the React Podcast. I am your host, Michael Jackson, and I have a very very special guest here with me today, Nicolas Gallagher. Nicholas is the creator of many awesome things. Most recently, he's been working on a really cool project uh related to React called React Native Web. Uh now, if that if me saying those 3 words in succession didn't didn't sufficiently twist your brain, I want you to just sort of process that again and think about that again. React Native And so it's it's a project that uh that Nicholas has been working on now for probably about the last— what would you say, about maybe 1 or 2 years, Nicholas?

[00:01:07] Nicolas Gallagher: Yeah, 2 and a half years, probably.

[00:01:09] Michael Jackson: 2 and a half years. And uh and it's it was actually deployed, as far as I understand, on the on the new mobile.twitter.com website that you launched about a year ago.

[00:01:21] Nicolas Gallagher: Yeah, that's right.

[00:01:22] Michael Jackson: Yeah. And so uh so yeah, so 2 and a half years, so about a year and a half before that, uh you you were working on it. So um so tell us a little bit uh maybe about, first of all, what is React Native Web and how how the project's been going for you.

[00:01:38] Nicolas Gallagher: Sure. Um so the way to describe, the way that I would describe React Native for web is first by slightly re-describing React Native. So I see React Native as um the design of a framework that has to sit on top of different platforms. So rather than converting or creating like a uh a React uh wrapper, so to speak, around uh the abstractions that exist in a given platform like React DOM did, when you have multiple platforms, you instead have to come up with um an interface for building your apps that is uh agnostic of those platforms. And so that's what React Native is to me. And so when I first saw React Native when it came out, I immediately wanted to work on the web with similar building blocks, you know. Building blocks in React Native are more powerful than the ones you get out of the box in ReactDOM. So React Native for Web is simply a web backend for the React Native interface. And I think if React Native had been called something different, like React Platform, then the name of this particular project wouldn't seem so confusing.

[00:02:40] Michael Jackson: Yeah, I totally agree. Um, so so you said a couple of things in there that uh that are that are pretty interesting. Um, One was, you know, when you when you saw the React Native API, you immediately uh had this idea for, oh, I'm gonna I'm gonna put this on the web. Um, that, for some reason, I I don't know why, but being a a a guy who has worked on the web most of my career, I didn't I didn't have that that thought. Do you know, can you tell me why maybe you— um, I mean, why why you kind of were inspired to do that? Do you do you can you point to any past experience or something that that helped you to sort of recognize the potential?

[00:03:16] Nicolas Gallagher: Well, it was um it was still quite early on in the process of building what became Twiddle Lite. So we we were and then maybe a few months into uh rewriting everything in React again. And uh and so understanding that you have common UI patterns that you want to implement. So when you're building like literally hundreds of components in quick succession, you start to see the things that you're doing over and over again and relying on Flexbox, predominantly relying on uh columns in Flexbox rather than rows, which is the default on the web. Um, wanting to do more at runtime in terms of dynamic adjustments to styles or to components and not using something like media queries, but rather like understanding, um, what does this component look like on the screen, you know, whether it's dimensions, what's currently going on. And in response to that, you might make some changes. Like, oh, I understand that my component is is beyond this certain width, and so now I know that my design should be adjusted to change the layout or introduce a new piece of uh a new piece of UI to that component. And so kind of coming across all these problems, as soon as I saw React Native, um I was like, oh, this is uh these are kind of abstractions that solve those problems. So I was experiencing a lot of of uh yeah problems or thinking, oh, why am I kind of redoing this work over and over? And when I saw React Native, just because I was in a similar problem space of effectively how do you build um high performance, like uh great web apps, how do you make it so that way any developer on the team can kind of build like a good touch interaction, for example. When I saw React Native, I was like, oh, they've already they've already done all this work. Um and even now I'm still constantly um surprised or impressed perhaps is a better word with the way that um things fall out of the React Native API. Um in particular, StyleSheet, I'm just constantly kind of going back to it and thinking, wow, this it really is well-designed um abstraction uh in terms of the people who worked on it. They understood in my opinion, they understood very well a lot of the problems that you experience as a as a UI engineering team. Um and it's no surprise, obviously, because Facebook has some exceptional people working on these problems. But but yeah, I'm just still uh and like the the the forethought and the uh clarity of understanding about how uh web and the issues with styling around web go. Um yeah, I'm constantly still impressed with that. So I think-

[00:05:35] Michael Jackson: Yeah, yeah.

[00:05:35] Nicolas Gallagher: It's made my life a bit easier with the React Native web project because a lot of it is largely uh implementing existing APIs. And so that's kind of both fun because it's a little bit of a challenge of like, oh, can I get this to work on the web? But also it removes a lot of that very difficult work of um designing the the API itself, which, you know, it's quite nice to be able to build a framework without having to define the API.

[00:05:58] Michael Jackson: Absolutely, absolutely. The DOM, I feel like, gives you, you know, it gives me a lot of elements, uh a lot of elements, and they and it just got even bigger, right, with HTML5. Um and now I have You know, all sorts of elements. And and sometimes I look at these elements, this bag of elements, and I think, what am I doing with all these elements? All I really want is a block element and an inline-block element and a span element, you know, or or an inline element, essentially. And like, if I just had those three, then I could build whatever sort of UI that I want to build. And and the people who are, you know, the people who are uh who are all about, you know, using elements for semantics right now are probably uh probably uh you know rolling their eyes. But but what I think about is, you know, primarily what I'm using these elements for is I'm using them for layout. I'm not using them to describe the content of of the of the document, right? I'm using them to position things and to you know to to space things. Um and so uh so yeah, I I you know the more I've thought about React Native uh taking that API and putting it on the web, the more it's made a lot of sense.

[00:07:11] Nicolas Gallagher: Yeah, and I think I think that that aspect of the elements is— uh there's so rather than having lots and lots of uh like element style building blocks, there are a handful in React Native, the base ones. And and instead you kind of describe the accessibility features that you want from them. Um so rather than kind of— uh so in your mind when you're building something, you'll think, I need this area of the screen to be visible to screen readers, and when they focus on this element, I need it to be read. And when they interact with this, I need them to understand that it's, you know, a checkbox or something like that. And then and then we have to try and deconstruct that in our minds and we go, okay, so because of my expertise on the web, I know that this means I need to use this particular element and then I need to use this ARIA role, but not if this condition exists, in which case I need to do something else. And so there's a lot of uh transformation and we kind of assemble lots of little smaller building blocks like ARIA roles and various HTML attributes and HTML elements. And the relationships between them. And what the React Native interface does is more kind of you just say, um, these are the accessibility traits of my element, and then the web implementation and the native implementation like figures out how to represent that in the platform-specific code.

[00:08:22] Michael Jackson: That's beautiful. I mean, that's that's React itself, right? I mean, React, uh, for example, if I say div onClick, uh, you know, I don't I don't actually tell you when to add the event listener or when to, you know, do that behavior. You just know that there is a div that that should have some behavior, right? And and so in this case, there is a uh a piece of UI that should have some accessibility characteristic. You figure out the best way to make it happen on on whatever platform you're on.

[00:08:48] Nicolas Gallagher: Yeah. So so if you're used to working on the web, you you might um if you don't see uh elements that aren't divs, or if you don't see elements of lots of different types, and if you don't see certain uh properties on those uh on those uh elements, You might start to think, oh, this can't be accessible. But it's simply because we uh the line, the space between those uh tools and the way that we think about accessibility is so small that we jump like almost instantly from thinking about accessibility to the HTML tags and properties that you need to make it accessible. And so when you don't see them in a UI component, you just see views and things like accessibility role and accessibility traits and important for accessibility. You kind of go, "Well, where's the accessibility stuff?" Because it's not the stuff that you're used to. But it's all there. It's just like- well, it's not all there, but the the core parts that that you need to use are there. And so the thing that I think it could also enable is if you are an accessibility expert and you understand like the entire ARIA spec and all the way in which all these bits and pieces work together, you can still drop into that if you really need to. And you can still use that, in fact, by just using React DOM if you want to implement something. But if you're working on a team, I think the building blocks in React Native can actually make it easier to make some experiences more accessible by default simply because there are fewer options. And in the cases where there are complexities around how to implement something accessible, the framework kind of takes care of it for you, managing all these things from like tabindex, ARIA roles, the element uh type itself, and kind of combines them in a way that um that gives the outcome that you would want, or that you would hope that, you know, people with who develop these patterns, the accessibility experts, they come up with. And the framework can just do the work for you.

[00:10:30] Michael Jackson: That's wonderful. So would you say then that the— uh I mean, it it feels like it should actually be easier to to incorporate accessibility, which by the way is is incredibly important. I'm very pleased that we're we're talking about this. I I didn't realize that the discussion was gonna go in this direction, but But it's incredibly important. Um, would you say that then you think it's essentially easier to build an accessible app when you've, you know, when you've got an an abstraction that kind of has it baked in, right? I mean, have you built any any sort of um any sort of other abstractions around accessibility that you think will be, you know, useful for for people? Or is it or is it more of kind of like a something at the framework level? What what I mean is, have you built any components that are you know specific to accessibility, or is it more just sort of you know the the framework is aware of how to how to make things accessible?

[00:11:20] Nicolas Gallagher: Yeah, it's it's mainly the latter. Um, I mean, I like the idea of uh of like if I when I was working on Twitter Lite, um ideas like creating uh a part of the app that kind of that can be used for ARIA live announcements. Uh that's not something that's in there, but it's all you know it's all doable from within React Native as well. So I think that it does make it easier to make um common scenarios more accessible by default. Um I think it can also help with some aspects of if you were to automate that around linting. I think at the moment the the DOM kind of accessibility linter has to try and kind of figure out how all of these things fit together itself as well. So it might throw a warning in a situation where as the developer, you know, that a warning isn't necessary because in this case you're You know, you're kind of using a trapdoor, you understand what you're doing. And I think when a framework has much more um defined ways in which accessibility properties are used, it can help with some of the automation around uh checking that certain things are are correctly marked up. Um but I'm not gonna say that it can do everything that you could do if you were using um all the ARIA roles, because they're not represented in yet. But like I said, you can still you can still drop into that. To make um leaf components that are as accessible as you want them to be. But then when you're, you know, handing over um components for your team to work with, they can have this kind of simpler um way to configure common accessibility.

[00:12:45] Michael Jackson: So so you can still drop down into the into sort of, I guess, the lower level API, which ARIA, which is which is as far as I know web specific, right?

[00:12:54] Nicolas Gallagher: Yeah.

[00:12:55] Michael Jackson: So so you you can still drop down there and and and sort of make something sort of specific for the web. Um, even though we've- which which kind of, I guess, leads me to to my next question is that, you know, when you were thinking about uh React Native Web or or when you were building out Twitter Lite, um, I'm sure the thought crossed your mind or or or or at least some kinds of discussions like, could we maybe reuse some of this in a React Native app?

[00:13:27] Nicolas Gallagher: Yeah, we we did some prototypes with that um maybe like a year, year and a half ago. Um someone on the team took uh the DM section of Twitter Lite, and uh at the time it was built with— uh still styled with CSS modules, but all of our primitives were Vue and text. So they ported the styles over and uh and made a an iOS app that was uh basically like a DM app. Twitter DM app for iOS using React Native. So, um, so yeah, the step, the bridge between the two is relatively small.

[00:14:00] Michael Jackson: Yeah, it's it's it's it's pretty small. I remember actually the uh the first time I actually heard about React Native Web was I did this little this uh little calculator thing about a year ago, or maybe even longer than that. I I uh I basically wanted to uh just implement a little iOS app in uh in React, so I built this a little calculator, and and and not half an hour after I posted it, um you messaged me on Twitter and you said, "Hey, I built this thing in in React Native Web." And uh you know you essentially took the code and and and did a React Native Web version of it. And I was like, "You wrote it in what?" How how how did— because I hadn't heard of the the project at the time, but it was it was cool to see um you know, basically you swap out the divs for views and, you know, a lot of the styles still work. I mean, was there was there any other stuff that you had to do in that conversion that I that I didn't notice?

[00:15:01] Nicolas Gallagher: Well, like, so one one of the things that I really appreciate about React Native is that um you're effectively buying into a framework that gives you building blocks to do all kinds of work that is common to um many different types of experiences that people are trying to build. So So being able to use things like the built-in like onLayout API to give you measurements about a node, I used that to replace all of the stuff you had to write yourself by hand to to do the- you had this kind of like scaling of text in the you know to to represent the numbers. When numbers got really big, the text would get smaller. So little bits and pieces like that where um you know I might not- when I'm trying to implement these things, I don't really understand how to do them at first. And then once I get it working, the thing I like about it is that I can then just go back to relying more on the way that you think conceptually about something, which is, you know, when this thing lays out, tell give me its dimensions. And that there's an API that is almost a direct analog to that thought, rather than on the web, you mention that and then someone and then like, oh yeah, I understand what I'm doing. I'm like getting the DOM node and I'm like calling, you know, getBoundedClientRect or whatever, and I'm doing this and that. And so being able to have uh APIs like that are much closer to the way that you think about these things themselves. That's the thing that I really like. And so, yeah, if it's going in and editing a little example that someone's made in ReactDOM, and so that way they can see- For example, with you, I was hoping that when I show you the the equivalent in React Native, because you've just written it with ReactDOM, you can see where the changes are and you can understand, oh, there's actually not that big of a difference between the two, or there are some nice things about doing it in React Native that I couldn't do with uh with React DOM. Um and so things like that, or that I still enjoy moments like when I realize that um the work that's going on in the React Native space itself just automatically falls into place for React Native Web, like um DevTools integrations, for example. I didn't have to do anything. That was kind of worked on already in the React DevTools for React Native, and then uh someone else in the community made a pull request to make it work with React Native for Web.

[00:17:02] Michael Jackson: Yeah, I need to go back and I need to look at that code again because I I think I did miss I did miss some of that some of that stuff. Like the auto-scaling TextView, for me, um uh I I I I missed that. So I'm gonna go back and I'm gonna take a look at that again. Um I didn't realize that that you had that there was an abstraction uh over that because that was yeah it was kind of tricky to build uh using the web tech. And it'll be interesting to see how you did it using the um using the React Native API. So I'm gonna I'm gonna take another look at that again. Um, I noticed there was also like a, uh, there was, there was also kind of like a a kitchen sink of, um, of stuff. I think you built it using React Storybook, which by the way, that's another one of the people I want to get on this podcast is the the Storybook guys. You you built kind of like a kitchen sink of like, you know, little, little toggles and and little controls and things for a React Native web app. Is that is that something that's like packaged up that people can use or was that just kind of you experimenting with Storybook?

[00:18:05] Nicolas Gallagher: Well, the Storybook is-

[00:18:07] Michael Jackson: Is that like a standard library of elements for React Native Web?

[00:18:10] Nicolas Gallagher: Yeah, that is um the API effectively. That is um those are basically the React Native building blocks running on the web. So the Storybook is the kind of documentation for the for the library.

[00:18:20] Michael Jackson: Got it.

[00:18:21] Nicolas Gallagher: Which will also give you an indication of uh just how big The things that you can use. The React Native API is, in my opinion, too large. But only from the perspective of what I'm trying to do, which is um what is which is discover or find, you know, help figure out what are the what is the core set of building blocks that you would want to use to build things on native and web. And then some of these other components that are part of React Native, they can actually be built on top of those, on top of that core. They're just in React Native, I think, partly as a convenience. But I can imagine a future further along where something like React Platform exists and that's a subset of what's in React Native. And then React Native and something like React Web or whatever become these separate projects that have native and web-specific things built on top of the React platform. That's kind of where I see things going. But that storybook, yes, it's it's a place that you can kind of um You can see what the you can see what the library is and you can uh you can see live examples running.

[00:19:23] Michael Jackson: Yeah, yeah, it's it's it's pretty awesome stuff. Um, you've said if you've touched on a few things that I wanna that I wanna touch on. One is uh you touched briefly on like styles. So we've talked a lot about accessibility, we've talked a lot about I think the power of the abstraction. Um, for for anybody who's listening who is not aware, Nicholas Uh, has quite a reputation in the sort of CSS style uh community for developing Normalize CSS. Um, that was kind of the first uh thing I ever actually saw from Nicholas, uh and that was uh probably 5 or 6 years ago. That was that was uh a project that I I used to just drop that thing into any new web project and it would sort of, you know, uh it would just sort of uh make all of the different browsers, uh you know, have consistent sort of base styles uh for for the document that you're working on. So anyway, that that's I think where where uh Nicholas— uh you know, would you say that you're would you say that you're kind of like a styling sort of— I don't know, it's I I I guess it's maybe a passion of yours or a specialty or something?

[00:20:35] Nicolas Gallagher: Ah, um. I don't know.

[00:20:37] Michael Jackson: That's just part of the job. You just you just gotta get it done.

[00:20:41] Nicolas Gallagher: The the the path that you take into programming, um you know some part of that, for me it was HTML and CSS, and so um I guess that kind of just lingers around. It's something that um personally I became relatively familiar with with certain parts of aspects of styling web apps. And so um yeah, certainly one of the parts of React Native that I was drawn to was was the stylesheet API and some of the things that that that could that I thought that that could help us fix that I hadn't really been able to find you know satisfying solutions to via just um you know the kind of the layers of of uh conventions and and whatnot that we've built on top of CSS.

[00:21:20] Michael Jackson: Yeah. So so I recently I recently uh I I tweeted something, I suggested something and uh you DM'd me and said, "Oh, if if if that happens, then I couldn't do what I need to do with React Native Web." So I I suggested Oh, I think it was a couple of months ago on Twitter, I suggested to Dan Abramov, I said, "Hey, when is— uh, golly, Sunil's thing." Glamour. Glamour, yeah. I said, "When is when is glamour gonna be the default for the style prop?" Right? Because it seems like- so the style prop, first of all, I think is is a is a wonderful API. It's a great API. Um, you and Leland have convinced me uh primarily of of of that fact. And so I've just been using the style prop and recommending the style prop and really trying to help people understand that the style prop is is is a pretty great API when it comes to here is how to style something. And so I I look at, you know, the Glamour project and I think, well, the Glamour project, you know, Sunil chose to use this CSS prop, which uh which he's able to, you know, he sort of claimed that and said, okay, if you use the CSS prop, uh that means you're using the Glamour uh API and and he's built things like um. I think he's got like media queries and I think he's even got support for hover and stuff like that in the Glamour API. And so I thought, well, that's all stuff that you know the style prop is lacking. So why don't we just you know make Glamour the default behavior for the new style prop? And then uh it was just a just a thought that I thought, hey, maybe maybe that's a maybe that's a step forward, you know? And then you DM'd me and you said, well, you know, if that were the case, if we were to use Glamour, you know, for for for doing the style prop, then I would not actually be able to build something like React Native Web. So I I didn't fully understand that at the time. Maybe uh maybe you could help me understand how you're using or how you built the styling aspect of React Native Web and why that would make it difficult or impossible for you to do what you need to do.

[00:23:21] Nicolas Gallagher: Yeah, so the way that um that I think helps to think about the style prop is Similar to how you now think about the onClick prop in React. So onClick prop was actually a really convenient interface on, you know, just using the standard HTML. Very easy for you to understand what's going on as a beginner. You know, you're like, oh, I want when I interact with this element, I want something to happen. The problem was the way that it's, you know, implemented or the consequences of doing that at the individual level. So what React does is it allows you to keep that nice authoring experience, but then does all optimizations for you at the framework level. And so I I'd like to think of styling React Native as the same way. But the style uh part on the on in HTML is actually quite convenient. You can see exactly how an element's gonna look by looking at the style properties defined there. If every element is every other element is doing that as well, you don't really have to do much thinking about uh the potential for an ancestor to mess up the styling of something deep in the tree as you do when CSS uh descendant selectors. And so what I saw React Native doing was effectively taking the style prop, keeping all the good things about it, which is that it's very simple, that it doesn't have any state in it, and then uh adding a little bit to that API to make it more expressive and behind the scenes everything becomes more performant. And so if React DOM, which is what React Native for web is built on at the moment, if that were to put another layer of abstraction between uh between like and that between a framework and the underlying DOM, then you're just incurring more costs. It's the same reason why I don't recommend using another styling library on top of React Native or on top of React Native for Web, because you're just adding another layer of abstraction of cost on top of on top of the existing one. So as soon as a framework has its own solution for styling, if you want to drop below that, If it doesn't provide a trapdoor to do that, you're effectively stuck with the fixed cost of whatever abstraction you put on top of the style. And so what I like about the current React DOM setup is that I can make something like React Native for Web interoperate with all the existing React DOM ecosystem by just building it one layer on top. And React DOM is does have a a contract with you, which is that I'm gonna provide you with a standards-compliant DOM API. And so that's basically what I want to work with. I don't want to work with something that looks like the DOM but has something else. But when you're working with React Native, it doesn't look like the DOM and it's slightly different. So I think that keeping the abstractions in the, you know, in the kind of quote right place is uh-

[00:25:59] Michael Jackson: I see, I see. Absolutely, yeah. There's nothing worse than unwinding a uh a bad abstraction. I feel like uh we've all had to do that at some point in our careers.

[00:26:09] Nicolas Gallagher: Yeah, I don't want to leave the implication that Glamour is a bad abstraction. I just mean that if you add No, no, no,

[00:26:14] Michael Jackson: I wasn't

[00:26:15] Nicolas Gallagher: trying to. Then yeah, it's just another thing that you have to go through or you have to stack on top of.

[00:26:20] Michael Jackson: Yeah, yeah, thank you for catching me. You know, all yeah, all I meant to say was um that you know for for the purposes of building React Native Web, that would have been uh bad for for you in in the sense that you would have you you no longer had access to the sort of lower level that you that you needed to. To build what you needed to build.

[00:26:41] Nicolas Gallagher: Yeah, possibly.

[00:26:42] Michael Jackson: Um, but yeah, but on web projects, I I think it's, I think it's uh sorry, React, not React Native for web, but just React for web projects. I think it's I think it's a fantastic library. In fact, I'd love to have have Sunil on here to talk about it. Uh so one other point that you briefly touched on was, um you know, you said, you know, the future of sort of React. And I think that's uh that's a very, very interesting conversation to have. It's one that I I feel like a few people are having right now. There's React Native for web, and then Leland Richardson is also working on like a React Primitives uh project, which, you know, it doesn't— uh I I I last time I looked at React Primitives, it didn't seem like like he was using it a lot at Airbnb. I may be I may be uh mis mis speaking here. He may actually be using it, uh you know, at at work, but it it seemed like That was kind of a similar goal of React Primitives, right? And and I think he I think he may have actually forked uh React Native Web, or at least borrowed a lot of a lot of your ideas to put it in there. But it seemed like, you know, like he was thinking about this idea of like React platform, you know. Could you could you maybe talk a little bit more about that? Or or have you, you know, talked to anybody in, you know, React core about this kind of notion or gotten any sort of indication from anybody there that that that's a direction that React would actually like to move into? I mean, they've got that, you know, they've got that new RFC process. Maybe that would be a maybe that would be a good place to talk about it.

[00:28:15] Nicolas Gallagher: Yeah, so uh starting with React Primitives first. Um so at the moment, React Primitives is uh basically an interface sitting on top of React Native and React Native for Web that tries to uh provide you with a very small subset of what they export and Kind of a reimagining of the touchable APIs. I think it probably has similar problems to what ReactXP has, which is that when you decide to create a different API, you are no longer compatible with the rest of the React Native ecosystem. But something along those lines, you know, the idea of defining a smaller subset of the React Native API and making that the core that everything else is built on. I think that that's kind of what I meant by React platform. And the reason I think that that's important is that I think uh the React DOM ecosystem doesn't have a foundation upon which um everything else is built. So in React Native, if you install a React Native package, everything's using the same style library. Well, let's just say, you know, pretty much everything is using the same style library, has access to the same um APIs for doing things, you know, like measurement, layout, that kind of thing. And so that means that everything can kind of like interoperate on this um quite broad level. And the reason that I think the stylesheet aspect is so important is because when you think about styling in React apps, and this is true for the web as well, and this is why I think the React DOM or the React web ecosystem has so many problems, is that you have 3 ways that you can style an element. First is statically, so in HTML that would be your CSS file. In React Native it's StyleSheet.create. The other is what people call dynamic. So on uh if you're writing HTML, that would be inline styles. So you can respond to like a change at runtime. And in React, it would be an object in your render function that gets passed to style. And then the third is the kind of the escape hatch. So in React DOM, that would be you do findDOMNode.style.opacity, and then you change that. You change that property without calling React, without going into the more expensive React reconciliation process. And in React Native, it's uh setNativeProps and you can pass in more than just style. And so when you realize that you have these 3 places that you need to uh be able to do styling, one, you know, the first one is like cacheable and very fast. The middle one is kind of, I don't know, maybe you've got like a checkbox and you want to change the color. And the last one is for like high-performance styles, like running an animation or something. So being able to finding a solution that works for all 3 is actually quite tricky. And React Native and Starship create that thing of uh bringing style into the framework and not using it as a separate library that you bolt onto something else allows them to solve all three of those problems and allows me to solve them on the web as well, even though the implementation is radically different. Um so I think that one, I think that if you come to that realization or if you uh agree with my analysis of that situation, Then uh then you start thinking that the the React platform, so to speak, has to include um styling built built in. And I think the React Native one has proven that it can basically do everything that you you need. Um whereas the ones that are designed only for the web, you can't really bring them back to native, or they— uh if they pitch themselves as allowing you the full expressiveness of CSS, you know, when you read that, you should also understand that it also means you're buying into all of the problems that come from having full opaqueness with CSS. So going back to what I said at the very beginning, I'm just, as the more and more I keep digging into these problems and trying to understand how all these things fit together, the more I'm impressed with the things that StyleSheet and React Native got right and how how great a core foundation that is to to kind of try and push these ideas further and further.

[00:32:05] Michael Jackson: Awesome. Well, thank you uh so much for for taking the time to to you know be on the on the uh podcast today. Thanks for having me. I don't I don't want to take too much of your time. You are um I think you are dead on with a lot of the stuff you've been uh we've been you know saying both today and both in in conference talks and things that I've heard you give in the past. Um I think the the React Native Web project is is super, super interesting. I think you're you know you're thinking about all the right things. Um so I would encourage you know anybody who's listening, who wants to give it a shot, um what is it, just on your personal GitHub, is that right, Nicholas?

[00:32:43] Nicolas Gallagher: Uh yeah, it is on my GitHub.

[00:32:45] Michael Jackson: Yep, so Nicholas, uh React Native Web, go ahead and give it a shot. I believe it's actually in uh in create-react-app, isn't it? So I could import something from React, I could import Vue, for example, from React Native and get React Native Web, right?

[00:33:00] Nicolas Gallagher: Yeah, there's uh some aliasing set up in there, so um the the example, the demo app on the React Native Web README is actually running on Glitch using create-react-app.

[00:33:12] Michael Jackson: Oh, sweet. So so it should be pretty easy for people to get started with it if they wanna they wanna give it a shot and and try it out. All they'd have to do is uh create a new React app.

[00:33:20] Nicolas Gallagher: Yeah, very very easy to try it out. And and that's the thing that I encourage people to do. Um I tend to be like a little bit quiet or hesitant about really like evangelizing about this stuff heavily or really beating this drum because I am always a little bit um doubtful or questioning, I should say, about the things that that I'm working on. Um.

[00:33:40] Michael Jackson: Cautious, let's just say.

[00:33:41] Nicolas Gallagher: Yeah, I'm not afraid to throw away stuff that I used to do. Like I don't use Normalize anymore, but it does mean that, um, yeah, I've done my due diligence, so to speak, to running this, uh integrating this uh framework under experiment, checking the performance and all of that. But um, but that's what I would um recommend that other people do. Try it out for yourself, kind of go through that period that you might have of it feeling unfamiliar and not really buying into it. And try some things out, check out the performance, you know, all the things that you care about, and see if it starts to make sense for the problems that you face. And I'd much rather have people kind of come to their own realizations through through use than than just believing what someone says because they once had a popular project on GitHub.

[00:34:25] Michael Jackson: Because they were on a podcast. Yeah, got it. Yeah, absolutely. I appreciate I appreciate that perspective. All right, uh thanks again for uh for coming on to the podcast and uh React Native Web, everybody. And thank you for uh thank you for listening in to the React Podcast this week. We are bringing it back and we will hopefully have another edition very, very soon. Thanks, Nicholas.