Introduction
@resilient is a focused set of React hooks for building applications that work gracefully on unreliable networks.
Why @resilient?
Modern web applications often assume a stable internet connection. But in the real world, users face:
- Slow or intermittent connections (2G, 3G)
- Sudden loss of connectivity
- High latency environments
- Data-conscious users who want to minimize usage
@resilient provides battle-tested patterns to handle these scenarios elegantly.
Core Hooks
useAdaptiveImage
Automatically select image quality based on network conditions
useAdaptivePolling
Smart polling that adapts to network speed and pauses when offline
useBackgroundSync
Queue requests offline and sync when connectivity returns
useNetworkStatus
Real-time network information (connection type, speed, online status)
Features
TypeScript First
Full type safety with comprehensive type definitions
Zero Dependencies
Minimal bundle size, no external runtime dependencies
SSR Safe
Works seamlessly with Next.js and other SSR frameworks
IndexedDB Persistence
Offline queue persists across page reloads