This keeps every site fast by default. But sometimes, client-side JavaScript is required. This guide shows how interactive components work in Astro using a technique called partial hydration. Most sites do not need to be fully controlled by Javascript. This concept of partial hydration leans into that. Using my personal site as an example, the only dynamic portion of the site is toggling dark mode. In the Nuxt version of the site, I was reliant on the Nuxt runtime to toggle light and dark mode.
Instead, it is a fundamental part of how pages are delivered to the browser. The HTML returned in response to navigation contains a meaningful and immediately renderable representation of the content the user requested.
Rather than load an entire SPA to handle a small portion of functionality, Vue can target a much smaller section of the DOM, and render only the portion of the application that I need in this case, a button and some JS to toggle dark mode. Vue supports this usage by default, but in the world of frameworks we tend to forget this.
A number of recent episodes of Views on Vue have explored this concept, including using Vue without an SPA and building micro frontends. The Wikimedia Foundation also uses Vue this way , rendering client-side functionality on top of an existing PHP monolith listen to my discussion with Eric Gardner to learn more. When viewed in this way, performance is almost a byproduct of following best practices with Astro. By submitting your details, you agree to receive occasional emails from the Asia Video Industry Association regarding our latest event, news and media updates.
I want to receive such emails I do not want to receive such emails. By signing up, you agree to our terms of use and privacy policy. I agree. I'm so excited for the potential here. Thanks for sharing. Mixing components, styling approaches, state management are really gonna be a game changer and partial hydration is just getting better and better with the support of web components and more conditionals like idle, visible, landing soon. I'd love to add this here: github. Awesome collection I've recently been working on some Astro projects myself would love if you could have a look at those:.
Nice one Chris thanks for doing these, I rarely get the time to work up something from scratch these days! Muhammad Ahmad - Nov 7. Oleksii Trekhleb - Oct DEV Community is a community of , amazing developers We're a place where coders share, stay up-to-date and grow their careers. Create account Log in. Twitter Facebook Github Instagram Twitch.
What's the point of difference with this one? Why does it "matter" so much? Check out this round-up of interesting travel ideas. Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment. Sophie Ibbotson Sophie is the founder of Maximum Exposure Limited, a consultancy company which develops and promotes tourism in emerging markets.
Related Articles. Where to holiday the coming months Nov 11, Where can Brits go without a pre-travel covid Nov 3, At the Crossroads of the Silk Road in Oct 30, Iconic hikes in the Norwegian Fjords Oct 29,
0コメント