@tauri-store/zustand - v0.1.0
    Preparing search index...

    Function createTauriStore

    • Create a new store with the given id and initial state.

      Type Parameters

      • S extends State
      • Store extends StoreApi<S>

      Parameters

      Returns TauriStore<S, Store>

      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);