Open History to see the last commit
1<script lang="ts">
2 import { useStore } from '@tanstack/svelte-store'
3 import { store } from './store'
4β
5 const { animal }: { animal: 'cats' | 'dogs' } = $props()
6 const count = useStore(store, (state) => state[animal])
7</script>
8β
9<!-- This will only re-render when `state[animal]` changes. If an unrelated store property changes, it won't re-render -->
10<div>{animal}: {count.current}</div>