mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
feat(useToastContext): add useContext hook for simpler use (#1125)
This commit is contained in:
parent
8f328ec6a3
commit
9f5d77eeb0
1 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { createContext } from 'react';
|
import { createContext, useContext } from 'react';
|
||||||
import type { TShowToast } from '~/common';
|
import type { TShowToast } from '~/common';
|
||||||
import { useToast } from '~/hooks';
|
import { useToast } from '~/hooks';
|
||||||
|
|
||||||
|
|
@ -10,6 +10,10 @@ export const ToastContext = createContext<ToastContextType>({
|
||||||
showToast: () => ({}),
|
showToast: () => ({}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export function useToastContext() {
|
||||||
|
return useContext(ToastContext);
|
||||||
|
}
|
||||||
|
|
||||||
export default function ToastProvider({ children }) {
|
export default function ToastProvider({ children }) {
|
||||||
const { showToast } = useToast();
|
const { showToast } = useToast();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue