Anna Sun
Initial OSS demo commit
2bd3674
raw
history blame
391 Bytes
import {createContext, useContext} from 'react';
import {Socket} from 'socket.io-client';
type SocketObject = {
socket: Socket | null;
clientID: string | null;
connected: boolean;
};
export const SocketContext = createContext<SocketObject>({
socket: null,
clientID: null,
connected: false,
});
export function useSocket(): SocketObject {
return useContext(SocketContext);
}