Hero.vue
Counter.svelte
index.astro
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ title: string }>()
const visits = ref(0)
</script>
<template>
<section class="hero">
<h1>{{ title }}</h1>
<button @click="visits++">
Visits: {{ visits }}
</button>
</section>
</template>
<script>
let count = 0
</script>
<!-- Counts clicks on the button -->
<button on:click={() => count++}>
Clicked {count} times
</button>
{#if count > 5}
<p>That is a lot of clicks.</p>
{/if}
---
import Hero from '../components/Hero.vue'
import Counter from '../components/Counter.svelte'
const title: string = 'My site'
---
<html lang="en">
<body>
<Hero title={title} client:load />
<Counter client:visible />
</body>
</html>
example/my-siteonmain
Changed (2)
src/components/Hero.vueM
src/pages/index.astroM
New files (1)
src/components/Counter.svelteA
Never pushed (1)
These look like secrets (.env, keys, databases) and stay on the server.
.env