@clave/use-dirty-tracking
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

useDirtyTracking

Track if one or more values have changed

Documentation

npm install @clave/use-dirty-tracking

This hook will let you konw if values have changed. For example in a form you can enable the submit button if the values have changed.

Usage

import useDirtyTracking from "@clave/use-dirty-tracking";

const [value, setValue] = useState("original");

// supply one (or more) values to track
const [isDirty, resetDirty] = useDirtyTracking(value);

// isDirty === false

setValue("changed");

// isDirty === true

resetDirty();

// isDirty === false

Readme

Keywords

none

Package Sidebar

Install

npm i @clave/use-dirty-tracking

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

36.4 kB

Total Files

21

Last publish

Collaborators

  • mariusgundersen
  • clave-no