And of course it includes like very interesting concepts like DOM components. So yeah. Nice. Well, you mentioned RSC and I think as I was watching your talk, it seemed like as a paradigm it's relatively similar to server components, even caution people to only pass serializable props to across the boundary. And it's very similar to how we now think about the component boundary in React server components. So two questions about that. One, is there any sort of like connection in terms of like the API implementation? And also, can we sort of interleave native and DOM components in the same way as we can do with server components where you can pass a server component as a child to a client component, et cetera?
Yeah, so I mean, the API design is somewhat related to like RSC, right? Where we have a directive to enable a different property like a different behavior of the component itself. So with RSC, you, well, you actually, we actually doing the same thing, right? Where we have a native context, well, in this case, the server. And we run it like we connect or bridge two things that are completely separate. But we make it so that it's all React. So you can just pass in props, you can pass in some other stuff and it works on both platforms. Now it's somewhat similar. I mean, both are an advanced bundling feature that we're adding to Metro. I wouldn't say they're like using the exact same code, but they are related in that sense, yes.
Nice, and I guess I was curious, like, would it ever be possible in the future to sort of go the other way around where you could just, you know, have most of your app being rendered as a DOM component and then just interleave a sort of a native component in there? Well, I mean, there are, with every approaches there are trade-offs, right? So in this case, the web view is somewhat slow. Like if you use it as a full screen, you can do tricks like eagerly load all the tabs in your app. So the load time when you swap the screen is almost nothing. And then if you add like a nice transition from one to another screen, it fades away completely. So I would say it's not necessarily, can you do it? It's like, of course you probably can, but it is better to just try it and iterate on it to see how good you can get it. That's also why like we showed the DOM component app or DOM comp.
The second question here, the highest rated question, you know, this goes to a little bit about what you said that, you know, this feature depends on, you know, advanced sort of bundler integration that you have in Metro. And, you know, most web developers today, you know, are not yet using Expo router, you know, as their kind of routing solution. So, you know, if somebody has a, you know, a midi-sized, you know, next.js app and they want it to go and, you know, port it over to mobile, what steps would that involve going from next.js for example? So next.js doesn't work at all on native, right? Like not just the framework itself, but the bundler is different. So there are many differences, like it's not compatible next.js and Expo, but the components that you write in next.js should kind of work in an Expo DOM component. So the only step you have to do first is going from a next router app or like next app router to an Expo router structure. Once you have that, you can fill in the blanks, like just like I did in my example, where I started with just three separate pages and then added the layouts to tie them together nicely on native. I would argue that that is the same steps that you have to take to go from a next app to like a proper native app. It can be daunting for a really large app, but if you move screen by screen and if you tweak them by screen by screen or like group by group, you should get there pretty fast.
Comments