all repos — caroster @ d453f1ded22e07a77357c43c71b7fde95ce233ef

[Octree] Group carpool to your event https://caroster.io

frontend/stores/useToastStore.ts (view raw)

 1import {ReactNode} from 'react';
 2import {create} from 'zustand';
 3
 4type State = {
 5  toast?: string;
 6  action?: ReactNode;
 7  addToast: (message: string, action?: ReactNode) => void;
 8  clearToast: () => void;
 9};
10
11const useToastStore = create<State>(set => ({
12  toast: null,
13  action: null,
14  addToast: (toast, action = null) => set({toast, action}),
15  clearToast: () => set({toast: null, action: null}),
16}));
17
18export default useToastStore;