wrap showToast in useMemo

This commit is contained in:
Alex Holliday committed 2026-09-04 13:16:11 -07:00
1 parent 1b97539eae
commit 7dbc7b3064
1 file changed
+3
+3
View File
@@ -1,6 +1,8 @@
import { toast, type ToastOptions } from "react-toastify"; import { toast, type ToastOptions } from "react-toastify";
import { useMemo } from "react";
export const useToast = () => { export const useToast = () => {
return useMemo(() => {
const showToast = (message: string, options?: ToastOptions) => { const showToast = (message: string, options?: ToastOptions) => {
toast.dismiss(); toast.dismiss();
const baseStyle: React.CSSProperties = { const baseStyle: React.CSSProperties = {
@@ -24,4 +26,5 @@ export const useToast = () => {
showToast(msg, { ...opts, type: "warning" }); showToast(msg, { ...opts, type: "warning" });
return { showToast, toastSuccess, toastError, toastInfo, toastWarning }; return { showToast, toastSuccess, toastError, toastInfo, toastWarning };
}, []);
}; };