14 lines
367 B
JavaScript
14 lines
367 B
JavaScript
import { createContext, useContext } from "react";
|
|
|
|
const SocketContext = createContext(null);
|
|
|
|
const INITIAL_NOTIFICATIONS = 10;
|
|
|
|
const useSocket = () => {
|
|
const context = useContext(SocketContext);
|
|
if (!context) throw new Error("useSocket must be used within a SocketProvider");
|
|
return context;
|
|
};
|
|
|
|
export { SocketContext, INITIAL_NOTIFICATIONS, useSocket };
|