React

A useField hook, a chat, and live cursors that don't re-render.

One shared connection per tab, and a hook over any field. Fields replace their state on every change, so useSyncExternalStore re-renders exactly when something changed.

.env.local
lib/socket.ts
components/chat.tsx

Cursors move up to 60 times a second per person, so they skip React state: subscribe once and write each cursor's position straight to its element, with transform only and no CSS transition.

components/cursors.tsx
cursors.css