Skip to content

Commit

Permalink
feat(useToastContext): add useContext hook for simpler use (danny-avi…
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila authored Oct 30, 2023
1 parent 8f328ec commit 9f5d77e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/Providers/ToastContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext } from 'react';
import { createContext, useContext } from 'react';
import type { TShowToast } from '~/common';
import { useToast } from '~/hooks';

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

export function useToastContext() {
return useContext(ToastContext);
}

export default function ToastProvider({ children }) {
const { showToast } = useToast();

Expand Down

0 comments on commit 9f5d77e

Please sign in to comment.