Fireship · @fireship
Astro just Launched.... Could it be the ultimate web framework?
Uploaded August 18, 2022 · Length 3:17
Summary
Astro web framework review: pros, cons, and use cases for building fast and interactive multi-page applications.
- astro web framework
- static site generator
- server-side rendering
- client-side routing
- javascript framework wars
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:01
it is august 18 2022 and you're watching
- 0:04
the code report one of the most
- 0:05
difficult decisions of a front-end
- 0:07
developer's life is choosing between
- 0:09
front-end ui frameworks because once you
- 0:10
get jumped into a gang it's really hard
- 0:12
to get out but what if there is a way
- 0:14
you could be a part of multiple gangs at
- 0:15
one time without causing a bunch of
- 0:17
complex drama well that's just one of
- 0:19
the amazing things that astro does which
- 0:20
is a tool for building multi-page
- 0:22
applications that just hit version 1.0 a
- 0:24
few days ago i made 100 second video
- 0:26
about it a while ago but it has some
- 0:28
really interesting new features and
- 0:29
deserves a second look at a very high
- 0:31
level it's kind of like a static site
- 0:33
generator that allows you to write
- 0:34
content and markdown using the file
- 0:36
system for routing then renders it all
- 0:38
as a static multi-page application for
- 0:40
templating it has its own language
- 0:42
called astro components which feel very
- 0:44
nice and familiar to the modern front
- 0:45
end developer what's really interesting
- 0:47
though is that you can bring in your
- 0:48
favorite front-end framework like react
- 0:50
spelt vue and so on and it will render
- 0:52
the ui on the server while shipping zero
- 0:54
javascript to the browser javascript is
- 0:56
the main bottleneck for performance
- 0:58
which means with astro you get really
- 0:59
fast page loads while using your
- 1:01
favorite javascript framework or
- 1:02
multiple frameworks at the same time but
- 1:04
you might be wondering how does a
- 1:05
component work if it doesn't have its
- 1:07
javascript with it the answer is it
- 1:09
doesn't it's just static html by default
- 1:11
however if you do need interactivity and
- 1:13
state you can opt into javascript as
- 1:15
needed to add islands of interactivity
- 1:17
to your website from a developer's
- 1:19
perspective astro provides a variety of
- 1:21
directives that determine when to
- 1:22
hydrate or load the javascript for a
- 1:24
component if you want to load it right
- 1:26
away like normal use client load but if
- 1:28
you don't need the component to be
- 1:29
interactive right away you can also use
- 1:31
idle to wait until the browser is just
- 1:33
chilling or visible to wait until the
- 1:34
component comes into the viewport under
- 1:36
the hood astro is using a technique
- 1:38
called partial or selective hydration to
- 1:40
render components in place as opposed to
- 1:42
taking over the entire dom that's a huge
- 1:44
deal when it comes to performance less
- 1:46
javascript to run means faster page
- 1:48
loads and better time to interactive
- 1:50
scores that's awesome but astro can do
- 1:52
many things beyond the typical static
- 1:54
site generator like next.js it can
- 1:56
statically generate dynamic routes by
- 1:58
allowing you to define a git static


