react-sse-patterns
OfficialReliable real-time React with SSE and hooks.
System Documentation
What problem does it solve?
Building real-time React apps with Server-Sent Events often leads to flaky reconnections, stale UI after drops, and tangled state management. This Skill provides a proven external-store architecture with reconnection, snapshot rehydration, and typed event handling so your UI stays consistent and responsive.
Core Features & Use Cases
- External SSE Store with useSyncExternalStore: Maintain a singleton EventSource with subscribe/getSnapshot for React-safe updates.
- Connection Resilience: Exponential backoff, unbounded retries, and a clear connection status for user feedback.
- Fresh Data on Reconnect: Snapshot-first rehydration ensures state is current before incremental events resume.
- Typed Event Parsing: Strongly-typed event payloads across workspace, session, messages, todos, logs, changes, events, and compose.
- Domain Hooks Pattern: Combine initial fetch with live SSE updates (e.g., useWorkspaces, useSession) using Suspense + external store.
- Use Case: Keep a dashboard updated with build logs and task status where transient network issues are common; users see a non-intrusive reconnect banner and the data rehydrates instantly after recovery.
Quick Start
Ask to scaffold an SSE external store with useSyncExternalStore, exponential backoff reconnects, a snapshot-first handler, a connection banner, and example domain hooks that prefer live SSE data over initial fetch.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: react-sse-patterns Download link: https://github.com/sandgardenhq/sgai/archive/main.zip#react-sse-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.