UNPKG

socket.io-react-hooks-advanced

Version:

A modular and extensible React + Socket.IO hook library designed for real-world applications. Supports namespaced sockets, reconnection strategies, offline queues, latency monitoring, middleware, encryption, and more.

7 lines (6 loc) 205 B
import { createContext, useContext } from "react"; export const SocketContext = createContext({ socket: null, connected: false, }); export const useSocketContext = () => useContext(SocketContext);