over 3 years ago Syntax Podcast
Supper Club × Qwik framework from Miško Hevery, the Creator of Angular
- 00:39 Introduction to resumability
- 01:14 Mishko Hevery creator of Angular and Qwik
- 02:02 Scott summarizes his understanding of resumability
- 02:48 Mishko confirms Scott's understanding is correct
- 04:03 Mishko explains resumability through virtual machine example
- 05:15 Qwik compared to React and Next.js
- 06:18 Qwik uses familiar JSX and Hooks like React
- 07:08 Examples of components to make resumable
- 08:52 Qwik handles optimizations for you
- 09:16 Example of lazy loading components in React vs Qwik
Introduction to resumability
Guest 1
So if you are, like, a a React developer or or something like that, you're gonna wanna listen to this one because it's super interesting. So,
Guest 1
championing this thing, which is, resumability.
Guest 1
was. We talked about it, I don't know, like, a month or 2 ago, and,
Guest 1
So I thought,
Guest 1
we are going through All the, like, different kinds of, like, hydration and and server side and whatnot. And we got to the resume ability one, and Scott was trying to explain it to me, but I just I just wasn't grokking it.
Guest 1
why don't we have, the creator of quick on, which is one of the frameworks in the space right now that is sort of championing Champion run that that part of the application, whether it's a A counter or a shopping cart or something like that when it's needed. So it's sort of on demand loading both of the JavaScript, but as well as
Guest 1
like,
Guest 1
I was
Qwik uses familiar JSX and Hooks like React
Guest 2
templating language that React is using. Right? JSX, it's hooks, you know, for especially for a React developer. If you come too quick, you look at the stuff and you go like, This is very familiar, thing to do. Like, the 2 are aligned. It's not like you have a choice to make. Like, I could do the easy thing or I could do the performant thing, and I'm I'm at the time pressure, so I'm gonna do the easy thing. Right? Like, no. No. The 2 are the same. They they're literally the same.
Guest 2
and you should be up and running very quickly. And it's kind of intentional. This is not, that normally you have to do once your gets big. They're just part of the how QUIC works, And then let's say that this works, then you have another problem, which is like, great, but now I'm in a slow network and, like, this lazy loading really is bugging me because there's a delay, and so now I have to out, like, how do I prefetch these things? And you think you could just add a prefetch tag to the the the, HTML.
Guest 1
of components that you might want to make resumable
Guest 2
one of the things is When we were doing this, we wanted to bring something new to the table, and the new thing to the table is resumability.
Guest 2
And we can just focus on the value add, and the value add is resumability. Okay. Can you give us, like, maybe a couple examples It it came up and your spreadsheet was open with the cursor blinking at the next thing you could type in. Yeah.
Guest 2
And so we didn't wanna reinvent the wheel on everything else. And so we were like, what off the shelf components can we grab to make this thing, you know, do its thing so that we don't have to get distracted, In the quick ecosystem. You know, if you go to Vue, there is Vue and Nuxt. If you go to Solid, there is Solidance, I would start. If you go to SwaltKit, there is SwaltKit and, But now you also need to start doing prefetching, so then make sure if you're like in a tunnel or the connection is, Hick, you know, hiccupy or something like that. You you perform well, so you get,
Guest 1
Like, scan the docs in half a day, go through the tutorials, and and you'd be up and running pretty quickly because, like, the big thing is is it's JSX. Right? Like, you're you're using the same
Mishko explains resumability through virtual machine example
Guest 3
a JavaScript
Guest 3
framework to do user interfaces. Is that
Guest 2
Right? What you didn't see the 2nd time you did this is you didn't see the boot up sequence. You didn't see the BIOS come up. You didn't see the login screen. You don't have to log in. Like, you literally
Guest 3
a, just a a high level, like, quick as a thing is
Guest 3
with quick at all, maybe maybe it'd be good to give a, Like
Example of lazy loading components in React vs Qwik
Guest 2
You know, you talk to the experts, and the experts are like, that's easy. Just break up your application in smaller chunks. Right? Yeah. So let's go down that rabbit hole.
Guest 2
Because, like, it has to be rendered. And so you actually just made the situation worse. Because now instead of getting a single bundle that's all, you know, in line, Now you actually got 2 bundles, and the way React does this is it renders everything up to the suspense boundary, then it, like, gives up, waits for the thing to load, and then starts rendering again, And now in theory, this thing is lazy loadable. Right? So then you start up your application and you realize, actually, bunkers, it isn't
Guest 2
Into tooling hell. The tooling hell that's required for this thing. So so you say, well, the first thing you need to figure out is where exactly you're gonna put a boundary, and this is not obvious.
Guest 1
boundaries over? It's hell for anybody who is trying to do this. So from the right from the get go, the code that you write in quick is is going to be able to be chopped up and laser loaded as you need it and prefetched and and all of that good stuff. Yeah. So the one way to think about it is,
Guest 2
and deciding, like, when exactly should I fetch The code. Right? If I fetch all the code eagerly at the beginning, then that's kinda pointless because, like, that's the same thing as just loading everything.
Guest 2
And let's say you find a component that you wanna lazy load. So in React, you would, move the component to separate files so that you can, create a separate chunk, Then you leave behind the lazy, and and, like, why you would even want to do that? Yes. So so the interesting part about QUIC is that as a developer, So, that particular component is visible on initial render.
Guest 2
function call. Right? Then you put a suspense around it.
Guest 2
You know, from where it left off, and so now it's doing twice as much work. And I mean, not exactly twice as much, but, like, it's more work than it would just Yeah. Do the whole thing,
Guest 2
or lazy loading of components I would actually say that's that's that's dead on.
Guest 2
use effect functions, is also the performant It's only useful
Guest 2
Let's say you decide your application is big and you need to do lazy loading.
Guest 2
Right? I mean, application gets big, and then it it's too slow to load. And, Code splitting, and move it to a different Different host machine.
Guest 2
kind of an example to kind of appreciate,
Guest 2
And so you have all these problems that Arise when you try to lazy load something, So all of these optimizations So then you have to have some other mechanism for fetching the code,
Guest 2
this. So let's say scene?
Guest 2
Because you see the suspense How how close am I? No. It's actually pretty close.
Guest 2
use init functions. Like, every single thing you could possibly think of that could be delayed loaded, It automatically sorry. Swelt and Swelt kit. Right? And so,
Guest 2
it's pointless to do the rendering
Guest 2
for components that are not currently in the render tree. Right? If the component is in the render tree, Turns out that's broken.
Mishko confirms Scott's understanding is correct
Guest 2
the interesting bits are more about, like, listeners, And so as a developer, you don't really, prefetching of the code out of the box. There's a service worker that does that, and that's that's very intelligent.
Guest 2
And you boot up in Linux, and you literally watch in the window As Linux is booting up, so you see BIOS comes up, and then the boot up sequence happens, and then the login screen shows up, and then type in your username and password, and you log in. And then, you know, open up, I don't know, spreadsheet or something and, you know, start typing your expenses. Right? And at any point, You can heat hit the pause button, And and you could duplicate that and send it to a friend. That like, that's how the IE machine is brought. Right? Yeah. Yeah. So the the power of that was, like, oh, great. I can just, like, make Fifty copies of this thing or a 1000 100000 copies of these things and send it to all my friends, and they literally just resume where you left off. Okay. Okay. Yeah. No. No. I I I guess I, for the for the listeners who aren't familiar Right? And open it, and the machine is literally where it was. Like, where did you just left over? Like, it just resumed.
Guest 2
Why other frameworks can't do this? Like, what is it about them? Right? And then once you understand that, there's mobility. It's kinda like one of these things. Like, of course, obvious. Why would you do it any other way? So so it's more like that. Okay. Okay. So into it if you'd like. Yeah. Yeah. Let tell us about it. So the best way I can, I found to kind of explain it is,
Guest 2
do you remember when virtual machines first came on to, I'm almost curious. Like, what do you think user mobility is? Like, I wanna hear your side of the story, and then I see to kinda better understand, like, where where thinks where the message isn't getting through. So what what do you think it is? After going through the docs and whatnot, physical machine, because It it kinda works in Chrome and everywhere else. It just doesn't work. Like, it's just a hint that everybody else ignores, especially mobile devices.
Guest 2
I think the the trouble is that people say like, well, that sounds reasonable. Why can't my framework do that? Right? And so And so the fact that you made it lazy loadable didn't actually help anything.
Guest 2
and the virtual machine saves the full state of everything into the disk into a file.
Guest 2
And one one of the things you could do in the virtual machine is, like, let's say you're on your host machine. Let's say you're on Windows. Right?
Transcript
Announcer
so buckle up and grab that old handle because this ride is going to get wild.
Announcer
I thought there was gonna be food,
Announcer
This is
Guest 1
Welcome to Syntax.
Announcer
I sure hope you're hungry.
Announcer
Wash those hands, pull up a chair, and secure that feed bag, because it's time to listen to Scott Talinsky and Wes Boss attempt to use human language to converse with and pick the brains of other developers.
Announcer
Cool. I'm starving.
Announcer
the Syntax supper club.
Guest 1
This is the podcast with the tastiest web development treats out there.
Qwik compared to React and Next.js
Guest 2
Are used to that they do today in in the quick in the React ecosystem. We have kind of, you know, the equivalent of these things And the thing that blew my mind when I first saw this is that you can take this file directly.
Guest 2
Right? So,
Guest 2
basically, the full stack development that people you don't really have to think about it. Like, that's kind of the value proposition here is So that doesn't work.
Guest 2
are the 2 parts that together allow you to build anything you could build on Next. Js, and it's literally equivalent. Like, and it's not obvious that you even can. Right? So, like, we did a simple example of lazy loading component. But let's say the problem isn't that. Let's say the problem is that you have to lazy load a listener or only part of it or you know, there's, like, gazillion different ways you do that, and then, of course, if you go through all this trouble, you might not actually get the benefit you thought you had. You know, how do you measure this thing? Then how do you move these the best way to kind of describe it is like what other things are. Right? So so if you have mostly React developers. So Quick is just like React.
Guest 2
all of these ecosystems basically have the same parts. So quick and quick city place laser loaded boundaries everywhere. Like, everywhere we could possibly think of. Right? Speaking components, That we basically, My point of view is that whatever you can build with React or Angular or any of the other favorite frameworks of yours that you happen to have, You should be also be able to build in quick. So in terms of capabilities, it's in the same category. Yeah. Like, I got the feeling that you'd be able to,
Qwik handles optimizations for you
Guest 3
You get to write things with
Guest 3
a very similar API. It's it's not the same if you if you look at some of the docs, but, like, it's very similar to a lot of API.
Guest 3
A lot of stuff is nicer. Right? So you get a very similar API, but you get a more performant experience without having to really adjust your your, frame of reference that much? That's right. That's that's exactly it. And I think we can go down a,
Scott summarizes his understanding of resumability
Guest 1
to
Guest 1
only downloads the JavaScript enough to get, like, a good idea, but, like, Not too much because I still wanna ask them some really good questions. So, wrong about what resumability
Guest 1
It downloads the HTML
Guest 1
Yeah.
Guest 1
I think
Guest 1
pasted it into another tab, and the thing just Resumed.
Examples of components to make resumable
Guest 2
think about it or choose to make things resumable or not resumable. It's just The property of the system that automatically just happens for your whole application. So you just build an application as you would build any other thing.
Guest 2
and you don't even have to think about it. It's just it's just there. So is the pitch
Guest 2
is that, you you know, the easy thing, the obvious thing, the the The the natural thing to do when you're building your application component or what have you Mhmm. And Quick City is like, let's say, Next. Js or Remix.
Guest 2
You didn't have to do anything and just SEO out of the box. Right? So it's it's SSR first.
Guest 2
Then other property you get Is that well, we don't send all the JavaScript over until it's needed.
Guest 2
the application has these interesting properties, which is that, first of all, SEO out of the box, And then,
Guest 2
bundling, making sure that you don't have overly large bundle sis sizes.
Mishko Hevery creator of Angular and Qwik
Guest 1
quick rundown or or do you wanna give us a quick I can't.
Guest 1
applications,
Guest 1
do you wanna give us a quick,
Guest 1
both server and client side. So excited. Welcome. Thanks for so much for coming on. Thank you for having me.
Guest 1
among other things, creator of Angular, Angular JS, and now working on this sort of New approach, new mindset to It looks like you can do state, and I saw this amazing example where you literally just copied the HTML, So I watched a little bit of the YouTube video. I I went through the documentation, and then
Guest 1
Mishko Hevry. That's right. How that's how you pronounce your name? You got it on the 1st try, man. I'm very impressed. Nice. Awesome. So,
Guest 1
building