
Security News
Anthropic Identifies Biased Reasoning and Recklessness as Drivers of Claude’s PyPI Attack
Anthropic found biased reasoning and recklessness drove Claude Mythos 5 to publish malware on PyPI and compromise a security vendor.
@guoyunhe/react-storage
Advanced tools
React hooks for localStorage and sessionStorage with JSON serialization, custom serializer/parser, key prefix, and SSR-safe fallback
React hooks for localStorage and sessionStorage — JSON serialization, custom serializer/parser, key prefix namespacing, and real-time cross-tab sync. SSR-safe with zero direct dependencies.
useState-like API — drop-in replacement with the same [value, setValue] tuplestorage eventDate, Map, or any custom type<StorageProvider>window access during render, works with Next.js and Remixnpm install --save @guoyunhe/react-storage
import { useLocalStorage, useSessionStorage } from '@guoyunhe/react-storage';
function App() {
const [settings, setSettings] = useLocalStorage('settings', {
theme: 'dark',
fontSize: 14,
});
const [draft, setDraft] = useSessionStorage('draft', '');
}
Use serializer and parser to handle non-JSON types:
const [date, setDate] = useLocalStorage('date', new Date(), {
serializer: (d) => d.toISOString(),
parser: (s) => new Date(s),
});
Scope storage keys per app to avoid collisions:
import { StorageProvider, useLocalStorage } from '@guoyunhe/react-storage';
function App() {
return (
<StorageProvider prefix='dashboard_'>
<Dashboard />
</StorageProvider>
);
}
function Dashboard() {
// actual key: "dashboard_theme"
const [theme, setTheme] = useLocalStorage('theme', 'light');
}
Set defaults once at the top level:
<StorageProvider serializer={mySerializer} parser={myParser} prefix='app_'>
<App />
</StorageProvider>
All components reading the same key stay in sync — even across tabs:
function Counter() {
const [count, setCount] = useLocalStorage('count', 0);
return (
<div>
<button onClick={() => setCount((c) => c - 1)}>−</button>
<span>{count}</span>
<button onClick={() => setCount((c) => c + 1)}>+</button>
</div>
);
}
// Render multiple <Counter /> — they all share the same state
useLocalStorage<T>(key, defaultValue, options?)Returns [value, setValue] — same shape as useState. Values persist in localStorage and sync across tabs.
useSessionStorage<T>(key, defaultValue, options?)Same API as useLocalStorage, but stores in sessionStorage. Data is cleared when the tab closes. Useful for draft forms, wizard state, and ephemeral UI state.
options| Option | Type | Default | Description |
|---|---|---|---|
serializer | (value: T) => string | JSON.stringify | Custom serialize function |
parser | (raw: string) => T | JSON.parse | Custom parse function |
prefix | string | '' | Override the global prefix for this key |
<StorageProvider>Provides global defaults for all hooks within its subtree.
| Prop | Type | Default | Description |
|---|---|---|---|
serializer | (value: any) => string | JSON.stringify | Global serializer |
parser | (raw: string) => any | JSON.parse | Global parser |
prefix | string | '' | Global key prefix |
| @guoyunhe/react-storage | use-local-storage-state | usehooks-ts | react-use | ahooks | |
|---|---|---|---|---|---|
| React peer | >=16.8 | >=18 | >=16.8 | * | >=16.8 |
| Dependencies | 0 | 0 | 1 | 14 | 10 |
| Local + Session | ✅ | ❌ | ✅ | ✅ | ✅ |
| Cross-tab sync | ✅ | ✅ | ❌ | ❌ | ✅ |
| Key prefix | ✅ | ❌ | ❌ | ❌ | ❌ |
| Custom serializer | ✅ | ✅ | ✅ | ❌ | ✅ |
| Typed API | ✅ | ✅ | ✅ | ✅ | ✅ |
| ESM | ✅ | ✅ | ✅ | ✅ | ✅ |
FAQs
React hooks for localStorage and sessionStorage with JSON serialization, custom serializer/parser, key prefix, and SSR-safe fallback
The npm package @guoyunhe/react-storage receives a total of 42 weekly downloads. As such, @guoyunhe/react-storage popularity was classified as not popular.
We found that @guoyunhe/react-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Anthropic found biased reasoning and recklessness drove Claude Mythos 5 to publish malware on PyPI and compromise a security vendor.

Research
/Security News
Malicious Chrome and Firefox extensions target Axiom Trade and Padre users, stealing session tokens and wallet data.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.