use-sync-storage-react
v1.0.0
Published
React 18 & 19 synchronized localStorage hook using useSyncExternalStore for instant cross-tab state syncing without tearing or hydration bugs.
Maintainers
Readme
🔄 use-sync-storage-react
React 18 & 19 synchronized localStorage hook using useSyncExternalStore for instant cross-tab state syncing without tearing or hydration bugs.
✨ Features
- 🌐 Instant Cross-Tab Sync — Updates in one browser tab reflect instantly in all other open tabs.
- 🛡️ Zero Hydration Mismatch — Built on React's
useSyncExternalStorefor Next.js and Remix SSR safety. - ⚡ Zero Heavy Dependencies — Native React implementation (<2 KB).
📥 Installation
npm install use-sync-storage-react🚀 Quick Start
import { useSyncStorage } from 'use-sync-storage-react';
export function ThemeToggle() {
const [theme, setTheme] = useSyncStorage('theme', 'light');
return (
<button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
Current: {theme}
</button>
);
}💖 Support the Project
If you find this package useful, consider sponsoring its ongoing development: 👉 Sponsor @Piratha97 on GitHub Sponsors
📄 License
MIT © 2026 Pirapaakaran Pirathapan
