Skip to content
Discussion options

You must be logged in to vote

storeToRefs

methods and non reactive properties are completely ignored.

This behavior is similar to toRefs


Use this instead:

<script setup>
import { storeToRefs } from "pinia";
import { useCounterStore } from "./counter.js";
const couterStore = useCounterStore();
- const { counter, increment } = storeToRefs(couterStore);
+ const { counter } = storeToRefs(couterStore);
console.log(counter); //ObjectRefImpl
- console.log(increment); //undefined
+ console.log(couterStore.increment);
</script>

<template>
  <button>{{ counter }}</button>
</template>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aSchaffe
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants