During this video we'll learn about Astro components and how they work.
Astro components are the basic building blocks of Astro. Writing components should feel familiar to writing HTML (or Twig) and the transition to Astro components will feel familiar.
There are two parts to an Astro component:
In the Component Script, you can do anything you’d normally do in JavaScript or JavaScript framework code: import other code, fetch data, import data, set variables. It’s the place where you get the business of the component done.
The Component Template is where you write the markup that will render your component in the browser. You can write plain HTML and nothing else, and Astro will dutifully build your page using that component. You can also use JavaScript expressions (like mapping data you fetched in the Component Script section). Or, you might need to use Astro directives, like set:html to handle data in a special way.

I am the creator of CraftQuest, a web developer, and former software team manager. I spend most of my time improving CraftQuest with code and courses. When I'm not in front of the computer, I spend my time with my family, and running on the roads and trails of Austin, TX.