Category | Utilities |
---|---|
Export Size | 260 B |
Last Changed | 2 weeks ago |
Holds the previous value of a ref.
import { ref } from 'vue' import { usePrevious } from '@vueuse/core' const counter = ref('Hello') const previous = usePrevious(counter) console.log(previous.value) // undefined counter.value = 'World' console.log(previous.value) // Hello
/** * Holds the previous value of a ref. * * @see {@link https://vueuse.org/usePrevious} */ export declare function usePrevious<T>( value: MaybeRefOrGetter<T> ): Readonly<Ref<T | undefined>> export declare function usePrevious<T>( value: MaybeRefOrGetter<T>, initialValue: T ): Readonly<Ref<T>>
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/core/usePrevious/