Back to blog
30 Mar 2025
1 min read

Adding a code playground

Adding a code playground using sandpack and react
import Playground from "./components/Playground";

<Playground
files={{
"/App.js": {
code: `import React from 'react';\n\nfunction App() {\n  return <h1>Hello, Astro!</h1>;\n}\n\nexport default App;`,
active: true
}
}}
theme="dark"
showEditor={true}
showPreview={true}
/>