use-rev
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

npm version Downloads

use-rev

A revision counter React hook.

This hook returns a number (a revision), and a function to increment the revision (the bump function).

  • The revision is guaranteed to always be truthy.
  • If the revision reaches Number.MAX_SAFE_INTEGER, it wraps back to 1.
  • The bump function is memoized with useCallback and will never change.

Installation

npm i use-rev

Usage

import { useRev } from 'use-rev';

// (inside a React component)
const [rev, bumpRev] = useRev();

Package Sidebar

Install

npm i use-rev

Weekly Downloads

2

Version

1.0.4

License

ISC

Unpacked Size

3.38 kB

Total Files

5

Last publish

Collaborators

  • ts-web