Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I read "how astro works" but I don't really get it. How can this work for dynamic content? Does it render every possible scenario?

What if data changes?



Check out the islands architecture info, or search around for info on partial hydration. It's similar to how things worked in the jQuery days--you serve up plain old HTML and have a JS function that runs on page load to attach all the event handlers (onclick, etc.) to your dynamic elements (i.e. 'hydrating' the static HTML into dynamic HTML + JS components). The thing with frameworks like Astro is that they try to automate and manage all of that hydration for you, which is nice because for complex sites with lots of different components it becomes a huge, error prone chore to manually wire things up.

edit: Island architecture background info: https://jasonformat.com/islands-architecture/


Currently you build a static site like you do with Gatsby or Jekyll or any other static site generator. In the future it will support dynamic server rendering.


Ok so it is a static site generator. Wasn't really obvious from the landing page.

Doesn't almost every large front end framework have a static site generator? I think Vue for example has it built in for example.

Why would anyone use this over the already existing one in their current ecosystem?


I can't speak for every frameworks' SSG tool but most of them load a full SPA on the client and have poor performance. Go pick out a random website for Gatsby's showcase page and see how much JS is loaded (spoiler: a lot).

Astro focuses on partial hydration where you only load the JS for the specific components that need to run in the client. Very few tools and none of the framework SSG's that I'm aware of do this.

There's also a variety of other features that Astro brings, the blog post talks about them.


Ok well it seems kind of cool, maybe I'll try it out. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: