Astro focuses on complete server-side rendering to speed up page loads. Other popular frameworks (NextJS, Remix, Svelte) rely on client side rendering. The trade off is that while server side can be quicker depending on your internet speeds, other errors don't occur as often such as hydration errors.
The reason for the speed is that Astro used Multi-page application (MPA) architecture as opposed to the other popular SPA (Single Page Application). The main difference is that MPA and Astro loads HTML pages from the server whereas SPA loads, you guessed it, a single page with JavaScript locally and sorts through the pages as the user navigates.
Astro also focuses on content rich websites as opposed to feature rich sites that you can build with the aforementioned frameworks. However, that does not mean that you cannot build in Astro without those as Astro provides support for many of those frameworks out of the box.
The Astro framework builds it's web-pages out of islands. You can think of islands like sections on a page or maybe even components for those of you coming from other web dev utilities. These islands can be a mix of interactive and non-interactive and let you easily build out a page. These islands can be built using your favorite UI framework; React, Svelte, Vue, etc. Islands strip out any unused client-side Javascript from the frontend framework to keep your site speedy and responsive.
Another great benefit of Astro's island feature is that you can prioritize each island or component individually with _client _directive. This makes it so that certain islands load based on the priority. Meaning that if you have an island that needs to load first for whatever reason or is heavy on JS, this can structure it so that the higher priority islands load first or that your JS-heavy island can hydrate only when the user sees this part of the webpage.
That's all for now. The next article we'll discuss basics of Astro projects.
This is part 1 in a multi-part series. Anything to add or corrections? Please let me know.
Top comments (0)