mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02: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 { useToast } from '~/hooks';
|
||||
|
||||
|
@ -10,6 +10,10 @@ export const ToastContext = createContext<ToastContextType>({
|
|||
showToast: () => ({}),
|
||||
});
|
||||
|
||||
export function useToastContext() {
|
||||
return useContext(ToastContext);
|
||||
}
|
||||
|
||||
export default function ToastProvider({ children }) {
|
||||
const { showToast } = useToast();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue