...and JAMStack done right
"Modern" web apps and SPAs became a thing circa IPhone 4, when we decided Flash was a bad idea.
This guys' to blame :D
Enter Astro.js
A static-site generator that also does SSR
Aims for zero JS
Component based
"Islands" architecture
Works really well with headless CMS
// Title.astro
<div>
<h1>I'm an Astro component</h1>
</div>
---
import Title from './Title.astro';
---
<main>
<Title />
</main>
---
import Title from './Title.astro';
---
<main>
<Title />
</main>
---
// Title.astro
const title = "I'm an Astro component";
---
<div>
<h1>{title}</h1>
</div>
---
import Title from './Title.astro';
---
<main>
<Title />
</main>
---
// Title.astro
const props = Astro.props;
---
<div>
<h1>{props.title}</h1>
</div>
---
import Title from './Title.astro';
---
<main>
<Title title="I'm an Astro component" />
</main>
---
// Example: Use a static React component on the page, without JavaScript.
import MyReactComponent from '../components/MyReactComponent.jsx';
---
<!-- 100% HTML, Zero JavaScript loaded on the page! -->
<MyReactComponent />
<!-- This component is now interactive on the page!
The rest of your website remains static and zero JS. -->
<MyReactComponent client:load />
More about directives at: https://docs.astro.build/en/reference/directives-reference/#client-directives
You now know about 70% of what Astro is about.
Lessons learned, benefits and drawbacks
Questions?
✏️ https://darko.io