</>PackageGraphPackageGraph

use-callback-ref

npmv1.3.3TypeScript

The same useRef, but with callback

Adopt with care

use-callback-ref is usable, with caveats. Last published 631 days ago.

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • CMaintenance: grade C, Fair — worth a look.

    Last published 631 days ago.

  • AWeight: grade A, Excellent.

    Pulls in 1 transitive package, about 51 KB installed (at least — some of the tree is still being crawled).

  • 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-callback-ref to a project.

1
Direct dependencies

Runtime packages this one declares itself.

1
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

51 KB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.

Compatibility

Node.js
node >=10
Module format
ESM + CommonJS
TypeScript
Types included
Install scripts
None

Quick start

A usage example from the use-callback-ref README.

import { useRef, createRef, useState } from 'react';
import { useCallbackRef, createCallbackRef } from 'use-callback-ref';

const Component = () => {
  const [, forceUpdate] = useState();
  // I dont need callback when ref changes
  const ref = useRef(null);

  // but sometimes - it could be what you need
  const anotherRef = useCallbackRef(null, () => forceUpdate());

  useEffect(() => {
    // now it's just possible
  }, [anotherRef.current]); // react to dom node change
Example truncated — see the full README.

use-callback-ref vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
use-callback-refthis page01MIT1 year ago
react152.8M82MIT1 day ago
react-dom143.7M47MIT1 day ago
react-style-singleton59.1M2MIT1 day ago
reselect44M1MIT1 day ago
next40.6M0MIT1 day ago

Dependencies

Declared by use-callback-ref v1.3.3. Runtime dependencies are installed with the package; dev dependencies are not.

Runtime (1)

tslib ^2.0.0

Dev (6)

@size-limit/preset-small-lib ^11.0.2@testing-library/jest-dom ^6.1.5@testing-library/react ^14.1.2@theuiteam/lib-builder ^0.3.0jest-environment-jsdom ^29.7.0size-limit ^11.0.2

Used by

Popular packages that depend on use-callback-ref.

Relationship graph

Dependencies (left) and dependents (right) of use-callback-ref.

@types/reactreactreact-remove-scro…use-callback-ref
use-callback-ref dependencies dependents

Frequently installed together

Release history

1 release in the last two years, typically about 109 days apart.

Recent versions of use-callback-ref
VersionPublishedSizeLicense
1.3.3latest1 year ago51 KBMIT
1.3.22 years ago51 KBMIT
1.3.12 years ago50 KBMIT
1.3.04 years ago47 KBMIT
1.2.55 years ago32 KBMIT
1.2.46 years ago31 KBMIT
1.2.36 years ago19 KBMIT
1.2.26 years ago18 KBMIT
1.2.17 years ago18 KBMIT
1.2.07 years ago18 KBMIT
1.1.07 years ago9.1 KBMIT
1.0.17 years ago6.3 KBMIT
1.0.07 years ago4.8 KBMIT

Overview

use-callback-ref is an npm package that the same useRef, but with callback. It has 1 known dependents in the graph. The latest version is 1.3.3, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need the same useRef, but with callback 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-callback-ref?

use-callback-ref is usable, with caveats. Last published 631 days ago.

How do I install use-callback-ref?

Run `npm install use-callback-ref` to add use-callback-ref to your npm project.

How many dependencies does use-callback-ref have?

use-callback-ref declares 9 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved totalling about 51 KB on disk.

What license is use-callback-ref released under?

use-callback-ref is distributed under the MIT license.

How popular is use-callback-ref?

npm does not publish download counts. Within PackageGraph's crawl, 1 known packages depend on use-callback-ref.

Is use-callback-ref still maintained?

The most recent release of use-callback-ref (v1.3.3) was published 1 year ago.

Does use-callback-ref run install scripts?

No. use-callback-ref does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.