Open History to see the last commit
1<script setup>
2import { useStore } from '@tanstack/vue-store'
3import { store } from './store'
4β
5const props = defineProps({ animal: String })
6const count = useStore(store, (state) => state[props.animal])
7</script>
8β
9<!-- This will only re-render when `state[props.animal]` changes. If an unrelated store property changes, it won't re-render -->
10<template>
11 <div>{{ animal }}: {{ count }}</div>
12</template>