Sha256: a7f5feedf8e3cdc49fc4afd7ed68a23216331bfc5c8c437c36f6dfda96670145
Contents?: true
Size: 643 Bytes
Versions: 5
Compression:
Stored size: 643 Bytes
Contents
import { create } from "zustand"; export interface Toast { type: string; message: string; } interface ToastState { toasts: Toast[]; error: (msg: string) => void; notice: (msg: string) => void; next: () => void; } const useToastStore = create<ToastState>((set) => ({ toasts: [], error: (msg: string) => set((state) => ({ toasts: [...state.toasts, { message: msg, type: "error" }] })), notice: (msg: string) => set((state) => ({ toasts: [...state.toasts, { message: msg, type: "notice" }] })), next: () => set((state) => ({ toasts: state.toasts.slice(1) })) })); export default useToastStore;
Version data entries
5 entries across 5 versions & 1 rubygems