Skip to content
Source
Sign inSign up
TanStack/store
Open History to see the last commit

Display.vue

12 lines405 Bytes

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>