npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ahooks-vue3

v1.0.3

Published

A high-quality & reliable Vue 3 Composition API hooks library, ported from ahooks

Readme

ahooks-vue3

A high-quality & reliable Vue 3 Composition API hooks library, ported from ahooks.

English | 简体中文

✨ Features

  • 🎯 Vue 3 Native: Built specifically for Vue 3 Composition API
  • 🔥 77+ Hooks: Complete port of all ahooks with Vue 3 equivalents
  • 💪 TypeScript: Written in TypeScript with full type support
  • 🌍 SSR Support: Works seamlessly with server-side rendering
  • 📦 Tree Shaking: Optimized bundle size with ES modules
  • 🎨 Easy Migration: Familiar API for ahooks users
  • Performance: Optimized for Vue 3 reactivity system

📦 Installation

npm install ahooks-vue3
# or
yarn add ahooks-vue3
# or
pnpm add ahooks-vue3

Usage

The package provides multiple module formats:

  • ES Modules: import { useCounter } from 'ahooks-vue3' (recommended)
  • CommonJS: const { useCounter } = require('ahooks-vue3')
  • UMD: Available via CDN for browser usage

🔨 Quick Start

<template>
  <div>
    <p>Count: {{ count }}</p>
    <button @click="increment">+</button>
    <button @click="decrement">-</button>
    <button @click="reset">Reset</button>
  </div>
</template>

<script setup lang="ts">
import { useCounter } from 'ahooks-vue3'

const [count, { increment, decrement, reset }] = useCounter(0)
</script>

📚 Hooks Categories

State Management

  • useBoolean - Boolean state management
  • useToggle - Toggle between values
  • useCounter - Counter with actions
  • useMap - Map state management
  • useSet - Set state management
  • useReactive - Reactive object state

Effect Hooks

  • useDebounce / useDebounceFn - Debounced values/functions
  • useThrottle / useThrottleFn - Throttled values/functions
  • useMount / useUnmount - Lifecycle hooks
  • useUpdateEffect - Effect that skips first render
  • useAsyncEffect - Async effect with cleanup

DOM & Events

  • useEventListener - Add event listeners
  • useClickAway - Click outside detection
  • useHover - Hover state tracking
  • useMouse - Mouse position tracking
  • useSize - Element size tracking
  • useScroll - Scroll position tracking

Storage & Network

  • useLocalStorageState - localStorage with reactivity
  • useSessionStorageState - sessionStorage with reactivity
  • useNetwork - Network status monitoring
  • useRequest - Data fetching with caching

Advanced Features

  • useVirtualList - Virtual scrolling
  • usePagination - Pagination logic
  • useInfiniteScroll - Infinite scrolling
  • useSelections - Multiple selections
  • useHistoryTravel - Undo/redo functionality

View all 77+ hooks →

🌟 Why ahooks-vue3?

Familiar API

If you're coming from React's ahooks, you'll feel right at home:

// React (ahooks)
const [count, { increment }] = useCounter(0)

// Vue (ahooks-vue3) - Same API!
const [count, { increment }] = useCounter(0)

Vue 3 Optimized

Built specifically for Vue 3's reactivity system:

<script setup>
import { useDebounce } from 'ahooks-vue3'

const input = ref('')
const debouncedValue = useDebounce(input, 500)

// Automatically reactive - no manual watching needed!
</script>

TypeScript First

Full TypeScript support with intelligent IntelliSense:

import { useRequest } from 'ahooks-vue3'

interface User {
  id: number
  name: string
}

const { data, loading, error } = useRequest<User[]>('/api/users')
// data is automatically typed as User[] | undefined

🔨 Usage Examples

Basic State Management

<script setup>
import { useBoolean, useToggle, useCounter } from 'ahooks-vue3'

// Boolean state
const [loading, { setTrue: startLoading, setFalse: stopLoading }] = useBoolean(false)

// Toggle between values
const [theme, { toggle: toggleTheme }] = useToggle('light', 'dark')

// Counter with actions
const [count, { increment, decrement, reset }] = useCounter(0)
</script>

DOM & Events

<script setup>
import { useEventListener, useClickAway, useHover } from 'ahooks-vue3'

const buttonRef = ref()
const isHovering = useHover(buttonRef)

useEventListener('keydown', (event) => {
  if (event.key === 'Escape') {
    console.log('Escape pressed!')
  }
})

useClickAway(() => {
  console.log('Clicked outside!')
}, buttonRef)
</script>

Storage & Persistence

<script setup>
import { useLocalStorageState, useSessionStorageState } from 'ahooks-vue3'

// Persisted in localStorage
const [user, setUser] = useLocalStorageState('user', { name: 'Guest' })

// Persisted in sessionStorage  
const [token, setToken] = useSessionStorageState('auth-token')
</script>

🤝 Contributing

We welcome all contributions! Please read our Contributing Guide.

📄 License

MIT License © 2024 ahooks-vue3 team

🙏 Acknowledgments

Special thanks to the ahooks team for creating such an amazing React hooks library that inspired this Vue 3 port.