Astro is a learnerās paradise!
My most recent āexperimentā was to render two identical components, one counter/button written in React (which I know) and one written in Svelte (which I do not know) on the same page. This was originally going to be a post comparing the two, and that post will happen.
But, while doing my end-of-the-month photo organizing, I finally got around to listening to Fred being interviewed on devtools.fm about Astroā¦ and THATās when it really clicked for me that Astro is the reason I can so easily play around with these various front-end tools, languages and frameworks as a learner.
When I set out to try writing a Svelte component, it didnāt even occur to me to go to CodeSandbox and find a Svelte template (which is absolutely what I would have otherwise had to do). Admittedly, I did have to go into my Astro config file and add a Svelte renderer, but Astroās error message was helpful in pointing that out when I was initially unsuccessful in rendering my Svelte counter.
There was zero start-up cost to write my first Svelte component, and Fred explains why (at 36:02):
āā¦youāve heard about this new framework, we are a great way to try it out. In any other project, you have to make a bet, this whole thing is gonna be React, and then thatās your project. Astroās one of the only ways you can ā¦ try it out, this one component. If you donāt like it, pull it out! No big deal! You didnāt just have to re-architect your entire project because you wanted to try a new frameworkā¦ itās certainly a great thing for experimentation. Thereās no cost to me to bring in a new framework, and that framework doesnāt actually break everything else that Iāve done.ā
Here are a couple of other quotations from the interview hosts that I found noteworthy enough to transcribe (before I realized that a transcription was available on their website, of course. SMRT.)
āThereās a lot to be said, if you do web development for a living, being able to play with different components and interject them directly into your blog posts. Itās like, āHey, hereās this really cool vue component, and the thing that it does!ā without really having to think about your architecture. Thatās super powerful.āā
āJust the idea that this can be expanded in the future, so if React falls out of vogue and thereās some new, better thing that comes along, we can jump on that ship and incrementally migrate with little to no cost.ā
So, eventually Iāll get around to writing the post to accompany the process of creating my React and Svelte counter buttons in the same page experiment, but for now, I thought it was noteworthy to discuss why that is such a big deal in the first place:
I didnāt have to go to CodeSandbox and look for a Svelte template, or find something to fork on GitHub.
I didnāt have to spin up anything new/different. I just literally added a new component, with a different file extension, into my already-existing, already-working blog.
I could LEARN Svelte through Astro, if I wanted to.
This isnāt just a āwrite in what you feel comfortable inā tool. This thing Iām learning is itself a learning tool, and code playground, all wrapped into my plain old website!