Is it intended to split the code into multiple files? #736
-
Thanks for this nice package, good job :) Given the following sample store using the composition API import { defineStore } from "pinia";
import { computed, ComputedRef, ref, Ref } from "vue";
export const useStore = defineStore("counter", () => {
const counter: Ref<number> = ref<number>(0);
const counterPlusOne: ComputedRef<number> = computed<number>((): number => counter.value + 1);
// ... many other getters here ...
function increment(): void {
counter.value++;
}
// ... many other actions here ...
return {
counterPlusOne,
increment,
};
}); Large projects might have quite big stores so it might be useful to split the state, getters and actions into multiple files. I would like to know if there are any utils to achieve that? Of course I could implement the logic somewhere else and import these functions but E.g. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Usually, you split the store into smaller, more specific stores. Otherwise, thanks to the composition api, you can just split stuff into functions, the same as with components. |
Beta Was this translation helpful? Give feedback.
Usually, you split the store into smaller, more specific stores. Otherwise, thanks to the composition api, you can just split stuff into functions, the same as with components.