React Integration Test
This page demonstrates that Astro Islands React integration is working correctly with Sparkle UI components.
Interactive Button Demo
Section titled “Interactive Button Demo”Simple React Component Test
Testing if a simple React component causes the sidebar layout issue:
This is a simple React component for testing layout issues.
Implementation Details
Component Location: docs/src/components/demos/ButtonDemo.tsx
Astro Directive: client:load - Hydrates immediately on page load
Integration: React component using @sparkle/ui Button with interactive state
Features Demonstrated
Section titled “Features Demonstrated”- ✅ Astro Islands: React components render on the client side
- ✅ @sparkle/ui Integration: Sparkle Button components work within Astro
- ✅ Interactive State: React state management and event handling
- ✅ TypeScript Support: Full type safety for React components
- ✅ Styling Integration: Components render with proper styling
Technical Details
Section titled “Technical Details”This integration enables:
- Client-side Hydration: React components are hydrated on the client
- Selective Interactivity: Only components marked with
client:loadare interactive - Optimal Performance: Static content remains static, interactive islands are hydrated as needed
- Component Reusability: Sparkle components work seamlessly in both Astro and React contexts
Configuration
Section titled “Configuration”The React integration is configured in astro.config.mjs:
import react from '@astrojs/react'import starlight from '@astrojs/starlight'
export default defineConfig({ integrations: [ react(), starlight({ // Starlight configuration }) ]})Component Usage
Section titled “Component Usage”React components can be used in Astro with hydration directives:
// Import the React componentimport { ButtonDemo } from './components/demos/ButtonDemo'
// Use with client-side hydration<ButtonDemo client:load />