docs: add advanced skills for Vitest, Pinia, and Vue built-ins
Add comprehensive reference documentation for: - Vitest: environments, projects/workspaces, type testing, vi utilities - Pinia: HMR, Nuxt integration, SSR setup - Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
This commit is contained in:
40
.agents/skills/vueuse-functions/references/usePrevious.md
Normal file
40
.agents/skills/vueuse-functions/references/usePrevious.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
category: Utilities
|
||||
---
|
||||
|
||||
# usePrevious
|
||||
|
||||
Holds the previous value of a ref.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
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
|
||||
|
||||
```ts
|
||||
/**
|
||||
* 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>>
|
||||
```
|
||||
Reference in New Issue
Block a user