Skip to content

Commit 9f5d77e

Browse files
authored
feat(useToastContext): add useContext hook for simpler use (danny-avila#1125)
1 parent 8f328ec commit 9f5d77e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client/src/Providers/ToastContext.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createContext } from 'react';
1+
import { createContext, useContext } from 'react';
22
import type { TShowToast } from '~/common';
33
import { useToast } from '~/hooks';
44

@@ -10,6 +10,10 @@ export const ToastContext = createContext<ToastContextType>({
1010
showToast: () => ({}),
1111
});
1212

13+
export function useToastContext() {
14+
return useContext(ToastContext);
15+
}
16+
1317
export default function ToastProvider({ children }) {
1418
const { showToast } = useToast();
1519

0 commit comments

Comments
 (0)