1.0.1 • Published 1 year ago

pinia-make-destructurable v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

pinia-make-destructurable

A modified version of Pinia's storeToRefs function that will also include the actions.

Usage

import { makeStoreDestructurable } from 'pinia-make-destructurable';

const useCounterStore = defineStore('counter', () => {
  const count = ref(0);

  const increment = () => count++;

  return { count, increment };
});

const { count, increment } = makeStoreDestructurable(useCounterStore());

console.log(count.value) // 0

increment();

console.log(count.value) // 1
1.0.1

1 year ago

1.0.0

1 year ago