pinia-make-destructurable
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i pinia-make-destructurable

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

6.47 kB

Total Files

9

Last publish

Collaborators

  • minetoblend