Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 342 Bytes

index.md

File metadata and controls

23 lines (15 loc) · 342 Bytes
category
Utilities

usePrevious

Holds the previous value of a ref.

Usage

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