Skip to content
On this page

Vue

Use @nanostores/vue and useStore() composable function to get store’s value and re-render component on store’s changes.

<script setup>
import { useStore } from '@nanostores/vue'
import { $profile } from '../stores/profile.js'
const props = defineProps(['postId'])
const profile = useStore($profile)
</script>
<template>
<header>Hi, {{ profile.name }}</header>
</template>

Imported from the Nano Stores README for version 1.5.5. Improve this page there.