Skip to content

Instantly share code, notes, and snippets.

@milogus
milogus / useWebSockets.tsx
Last active July 30, 2021 15:17 — forked from jonasgroendahl/useWebSockets.tsx
useWebSockets()
import {useEffect, useRef, useState} from 'react';
import io from 'socket.io-client';
type Props = {
userId: number;
enabled: boolean;
onConnected?: () => void;
};
type Message = {