Sha256: 199f5baf61b6bb6265aa152a3e07d66c589b93a3f9b59b679fd407f1aa4cc38e
Contents?: true
Size: 630 Bytes
Versions: 1
Compression:
Stored size: 630 Bytes
Contents
import { create } from "zustand"; type Toast = { type: string; message: string; } type 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/javascript/stores/useToastStore.ts |