First, add the MDX integration:
npx astro add mdx
// src/components/LiveCounter.jsx
import { useState } from 'react';
export default function LiveCounter() {
const [count, setCount] = useState(0);
return ;
}
---
title: Getting Started with Islands
publishDate: 2026-08-06
---
import LiveCounter from '../../components/LiveCounter.jsx';
## Why Islands Matter
Astro ships zero JavaScript by default. Try the live example below —
it's a real, interactive React component embedded directly in this
Markdown content.
Interactivity is opt-in, component by component, even inside content
like this post.