Pinia は Vue の公式ステート管理ライブラリ(Vuex の後継)です。多くのコンポーネント間で共有する必要があるステートの集中化された store であり、Composition API 上に構築されたシンプルで型安全な API を備えています。
ストアの定義
js
{ defineStore } ;
{ ref, computed } ;
useCounterStore = (, {
count = ();
double = ( count. * );
() { count.++; }
() { count. = api.(); }
{ count, double, increment, fetchInitial };
});
