Const
Create a new store with the given id
and initial state
.
import { create } from 'zustand';
import { createTauriStore } from '@tauri-store/zustand';
type State = {
counter: number;
};
type Action = {
increase: () => void;
};
const useCounterStore = create<Action & State>((set) => ({
counter: 0,
increase: () => set((state) => ({ counter: state.counter + 1 })),
}))
const tauriHandler = createTauriStore('counter-store', useCounterStore);
This is an alias for
createTauriStore
.