@guoba-ai/hook
@guoba-ai/hook
A small collection of React hooks — ESM-only, fully typed.
Installation
pnpm add @guoba-ai/hookRequires React 18+ as a peer dependency.
Usage
import { useDebounce, useToggle } from '@guoba-ai/hook'
import { useState } from 'react'
function Example() {
const [on, toggle] = useToggle(false)
const [q, setQ] = useState('')
const debouncedQ = useDebounce(q, 300)
// ...
}Available Hooks
useDebounce— debounce a valueuseThrottle— throttle a valueuseToggle— boolean state with toggleusePrevious— read the previous render's valueuseMount— run callback on mountuseUnmount— run callback on unmountuseSyncState— state with ref-sync access
📖 Full API reference → guoba-ai.vercel.app/docs/hooks