From 7c296536cae54a645e075b1e00bcd3d34d494bb9 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 21 Mar 2021 12:20:28 +0100 Subject: DOM -> toast :tada: --- components/toast.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'components/toast.tsx') diff --git a/components/toast.tsx b/components/toast.tsx index 5bfc0ae..d774c96 100644 --- a/components/toast.tsx +++ b/components/toast.tsx @@ -75,17 +75,14 @@ function Toast(props: { } -export var ToastContext = createContext<{ toast?: (message: string, - type: "confirmation"|"normal"|"error", - icon?: ReactNode ) => void }>({}); +export type toastType = (message: string, type: "confirmation"|"normal"|"error", icon?: ReactNode ) => void; +export var ToastContext = createContext<{ toast?: toastType }>({}); var toasts: Array = []; export function ToastContextWrapper(props: { children?: ReactNode }) { var [dummyState, rerender] = useState(false); - return { + return { toasts.push(); rerender(!dummyState); } }}> -- cgit v1.2.3