useMemoOne and useCallbackOne are React hooks that provide a stable cache semantic guarantee, unlike the built-in useMemo and useCallback which React may clear at any time (e.g. for memory freeing). This is particularly useful for concurrent mode and cases where reference stability is critical. v1.1.3 is current and stable, with peer dependency on React ^16.8.0 || ^17.0.0 || ^18.0.0. It also exports aliases useMemo and useCallback for drop-in replacement, but those will clash with React's own hooks if imported together.
npm install use-memo-oneNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of useMemoOne and useCallbackOne with stable cache semantics.
Only import useMemo/useCallback from one source, or use the explicit useMemoOne/useCallbackOne names.
Use only where reference stability is critical; otherwise prefer React's hooks for memory efficiency.
N/A
Consider alternatives if newer React features are needed
Use CommonJS require: const { useMemoOne } = require('use-memo-one'); or ensure bundler supports CJS interop.Move the hook call inside a function component or a custom hook.
Ensure hooks are called unconditionally and in the same order on every render.
Upgrade React to ^16.8.0 || ^17.0.0 || ^18.0.0 as per peerDependencies.