AI-friendly by design
The project is designed so coding assistants can choose durable state, SSR behavior, nullability, and migrations correctly without inventing storage semantics.
useState-like API
useMnemonicKey returns { value, set, reset, remove } — the same mental model as useState, with persistence built in.
SSR-safe by default
Server renders use defaultValue by default, with opt-in serverValue and client-only hydration controls when you need them.
Simple as useState
import { MnemonicProvider, useMnemonicKey } from "react-mnemonic/core";
function Counter() {
const { value: count, set } = useMnemonicKey("count", {
defaultValue: 0,
});
return (
<button onClick={() => set((c) => c + 1)}>
Count: {count}
</button>
);
}
export default function App() {
return (
<MnemonicProvider namespace="my-app">
<Counter />
</MnemonicProvider>
);
}
The counter value persists in localStorage under my-app.count and survives full page reloads.
Need the deterministic implementation contract? Read the AI docs.
Want an external third-party signal? See Context7's rankings for AI coding tools and documentation sources.
View Context7 RankingsAI Resources
react-mnemonic ships dedicated retrieval surfaces for coding assistants, DeepWiki, and local MCP-style documentation setups, while relying on Context7 for external ranking signals.
AI Docs
Canonical invariants, decision matrix, recipes, anti-patterns, and setup guidance.
Open AI Docsllms-full.txt
Long-form export for indexing, retrieval, and larger prompt contexts.
Open llms-full.txtai-contract.json
Machine-readable persistence contract for tooling and agent integrations.
Open ai-contract.jsonDeepWiki Priorities
DeepWiki steering file that points retrieval toward the highest-signal sources.
Open DeepWiki PrioritiesAssistant Setup
Generated instruction packs plus the documented MCP-friendly retrieval path.
Open Assistant Setupbackground video by MART PRODUCTION