@tabula/use-previous-value
v0.1.0
Published
Allows to keep previous value
Downloads
413
Maintainers
Readme
@tabula/use-previous-value
Allows to keep previous value.
Installation
Use the package manager pnpm to install @tabula/use-previous-value
.
pnpm add @tabula/use-previous-value
Usage
import { ReactNode } from 'react';
import { usePreviousValue } from '@tabula/use-previous-value';
type Props<T> = {
value: T;
}
export function ChangesDetector<T>({ value }: Props<T>): ReactNode {
const previousValue = usePreviousValue(value);
return previousValue != null && value !== previousValue ? 'Changed' : 'Not changed';
}
License
This project is ISC licensed.