Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

feat(useToastContext): add useContext hook for simpler use (#1125)

Danny Avila9f5d77eeb00b
diff --git a/client/src/Providers/ToastContext.tsx b/client/src/Providers/ToastContext.tsx
index 88229f9c0e..10ae884da6 100644
--- a/client/src/Providers/ToastContext.tsx
+++ b/client/src/Providers/ToastContext.tsx
@@ -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();