Skip to content

Instantly share code, notes, and snippets.

View jonasgroendahl's full-sized avatar
:octocat:
sending gifs

jonasgroendahl

:octocat:
sending gifs
View GitHub Profile
@jonasgroendahl
jonasgroendahl / useWebSockets.tsx
Created October 29, 2020 21:48
useWebSockets()
import {useEffect, useRef, useState} from 'react';
import io from 'socket.io-client';
type Props = {
userId: number;
enabled: boolean;
onConnected?: () => void;
};
type Message = {