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.

10 lines (9 loc) 267 B
import { createContext, useContext } from "react"; export const createSocketContext = () => { const Context = createContext({ socket: null, connected: false, }); const useCtx = () => useContext(Context); return { Context, useCtx }; };