Count: 0

useCounter

Basic counter with utility functions.

Usage

import { useCounter } from '@vueuse/core'

const { count, inc, dec, set, reset } = useCounter()

Type Declarations

/**
 * Basic counter with utility functions.
 *
 * @see /useCounter
 * @param [initialValue=0]
 */
export declare function useCounter(initialValue?: number): {
  count: Ref<number>
  inc: (delta?: number) => number
  dec: (delta?: number) => number
  get: () => number
  set: (val: number) => number
  reset: (val?: number) => number
}

Source

SourceDemoDocs