963 markdown files reformatted with the repository's pinned prettier so pnpm format:check covers the folded tree like every other repo file. The formatter's embedded-language pass also normalized code fences (TS semicolons, closed HTML tags in examples, lowercased CSS hex colors, one renumbered list that skipped an index). Alphanumeric token deltas vs the fold commit were audited file-by-file; all are formatter-equivalent markup normalizations plus the four sanitized skills.
721 B
721 B
category
| category |
|---|
| Utilities |
usePrevious
Holds the previous value of a ref.
Usage
import { usePrevious } from '@vueuse/core';
import { shallowRef } from 'vue';
const counter = shallowRef('Hello');
const previous = usePrevious(counter);
console.log(previous.value); // undefined
counter.value = 'World';
console.log(previous.value); // Hello
Type Declarations
/**
* Holds the previous value of a ref.
*
* @see {@link https://vueuse.org/usePrevious}
*/
export declare function usePrevious<T>(
value: MaybeRefOrGetter<T>,
): Readonly<ShallowRef<T | undefined>>;
export declare function usePrevious<T>(
value: MaybeRefOrGetter<T>,
initialValue: T,
): Readonly<ShallowRef<T>>;