quivr/frontend/lib/context/ChatsProvider/hooks/useChatsContext.tsx
Mamadou DICKO 9bb7ccf651
Frontend/test/chat 1 (#508)
* feat: add providers mocks

* test(<ChatPage/>: add render test using providers
2023-07-05 09:30:22 +02:00

15 lines
379 B
TypeScript

import { useContext } from "react";
import { ChatsContext } from "../chats-provider";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useChatsContext = () => {
const context = useContext(ChatsContext);
if (context === undefined) {
throw new Error("useChatsStore must be used inside ChatsProvider");
}
return context;
};