use-latest-callback
npmv0.3.5TypeScriptReact hook which returns the latest callback without changing the reference
Safe to adopt
Yes — use-latest-callback scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 45 days ago. 11 releases in the last 2 years.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- AMaintenance: grade A, Excellent.
Last published 45 days ago. 11 releases in the last 2 years.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 5.6 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding use-latest-callback to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Compatibility
- Node.js
- No constraint declared
- Module format
- CommonJS only
- TypeScript
- Types included
- Install scripts
- None
Quick start
A usage example from the use-latest-callback README.
import useLatestCallback from 'use-latest-callback';
// ...
function MyComponent() {
const callback = useLatestCallback((value) => {
console.log('Changed', value);
});
React.useEffect(() => {
someEvent.addListener(callback);
return () => someEvent.removeListener(callback);
}, [callback]);use-latest-callback vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| use-latest-callbackthis page | 0 | 1 | MIT | 1 month ago |
| react | 152.8M | 82 | MIT | 1 day ago |
| react-dom | 143.7M | 47 | MIT | 1 day ago |
| react-style-singleton | 59.1M | 2 | MIT | 1 day ago |
| reselect | 44M | 1 | MIT | 1 day ago |
| next | 40.6M | 0 | MIT | 1 day ago |
Dependencies
Declared by use-latest-callback v0.3.5. Runtime dependencies are installed with the package; dev dependencies are not.
Peer (1)
Dev (11)
Used by
Popular packages that depend on use-latest-callback.
Relationship graph
Dependencies (left) and dependents (right) of use-latest-callback.
Frequently installed together
React is a JavaScript library for building user interfaces.
More powerful alternative to Animated library for React Native.
A framework for building native apps using React
Color conversion and manipulation with CSS string support
The React Native multithreading library
Metro configuration for React Native.
No description provided.
Declarative API exposing native platform touch and gesture system to React Native
TypeScript definitions for react
Simple and complete React Native testing utilities that encourage good testing practices.
Release history
9 releases in the last two years, typically about 21 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 0.3.5latest | 1 month ago | 5.6 KB | MIT |
| 0.3.4 | 3 months ago | 6.2 KB | MIT |
| 0.3.3 | 9 months ago | 6.2 KB | MIT |
| 0.3.2 | 10 months ago | 6.2 KB | MIT |
| 0.3.1 | 11 months ago | 6.2 KB | MIT |
| 0.3.0 | 11 months ago | 5.6 KB | MIT |
| 0.2.6 | 11 months ago | 6.2 KB | MIT |
| 0.2.5 | 11 months ago | 6.2 KB | MIT |
| 0.2.4 | 1 year ago | 5.1 KB | MIT |
| 0.2.3 | 1 year ago | 5.9 KB | MIT |
| 0.2.2 | 1 year ago | 5.9 KB | MIT |
| 0.2.1 | 2 years ago | 5.9 KB | MIT |
| 0.2.0 | 2 years ago | 5.9 KB | MIT |
| 0.1.11 | 2 years ago | 7.0 KB | MIT |
| 0.1.10 | 2 years ago | 6.8 KB | MIT |
Overview
use-latest-callback is an npm package that react hook which returns the latest callback without changing the reference. It has 1 known dependents in the graph. The latest version is 0.3.5, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need react hook which returns the latest callback without changing the reference and value a focused solution.
When not to use it
Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.
Pros
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
Cons
- No significant drawbacks detected from available metadata.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Keywords
Frequently asked questions
Should I use use-latest-callback?
Yes — use-latest-callback scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 45 days ago. 11 releases in the last 2 years.
How do I install use-latest-callback?
Run `npm install use-latest-callback` to add use-latest-callback to your npm project.
What license is use-latest-callback released under?
use-latest-callback is distributed under the MIT license.
How popular is use-latest-callback?
npm does not publish download counts. Within PackageGraph's crawl, 1 known packages depend on use-latest-callback.
Is use-latest-callback still maintained?
The most recent release of use-latest-callback (v0.3.5) was published 1 month ago.
Does use-latest-callback run install scripts?
No. use-latest-callback does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.