ts-hooks-kit
Production-ready React hooks for React 18 & 19, fully typed and tree-shakeable.
Documentation · GitHub
React applications need reliable, well-typed hooks — but maintaining them across React versions is hard. ts-hooks-kit is a batteries-included hooks library that picks up where usehooks-ts left off, providing 50 production-ready hooks with full React 18 and 19 support, zero runtime dependencies, and a migration path from usehooks-ts.
- React 18 & 19: tested against both versions in CI
- Type-safe: first-class TypeScript with full type inference
- Tree-shakeable: import only what you use, keep bundles small
- Zero dependencies: React peer dependency only, no runtime deps
- Dual output: ESM + CJS builds via tsdown
- Drop-in migration: codemod to migrate from usehooks-ts automatically
npm install @ts-hooks-kit/core
# or
yarn add @ts-hooks-kit/core
# or
pnpm add @ts-hooks-kit/coreimport { useBoolean, useLocalStorage } from '@ts-hooks-kit/core'
export function Example() {
const [enabled, toggleEnabled] = useBoolean(false)
const [name, setName] = useLocalStorage('name', 'ts-hooks-kit')
return (
<button type="button" onClick={toggleEnabled}>
{enabled ? `Enabled for ${name}` : 'Disabled'}
</button>
)
}State
useBoolean · useCounter · useDisclosure · useList · useMap · useQueue · useSet · useStateList · useStep · useToggle
Storage
useLocalStorage · useReadLocalStorage · useSessionStorage
Browser
useCopyToClipboard · useDarkMode · useDocumentTitle · useGeolocation · useMediaQuery · useNetwork · usePermission · useScreen · useScript · useScrollLock · useTernaryDarkMode · useWindowSize
DOM
useClickAnyWhere · useEventListener · useHover · useIntersectionObserver · useOnClickOutside · usePageLeave · useResizeObserver
Timing
useCountdown · useDebounceCallback · useDebounceValue · useIdle · useInterval · useThrottle · useTimeout
Lifecycle
useEventCallback · useIsClient · useIsMounted · useIsomorphicLayoutEffect · useMemoizedFn · usePrevious · useUnmount · useUpdate · useUpdateEffect
Data
useAsync · usePagination
- Full documentation — live docs site with API reference
- Examples — interactive hook examples and real-world patterns
- Migration guide to move from usehooks-ts to ts-hooks-kit
- Compatibility for React version support details
- Contributing to get involved in development
Swap your imports automatically with the included codemod:
npx ts-hooks-kit-codemod <target-path> --dry # preview changes
npx ts-hooks-kit-codemod <target-path> # apply changesThe codemod rewrites usehooks-ts imports to @ts-hooks-kit/core and handles any renamed hooks.
Built on the excellent work of usehooks-ts by Julien Caron. Forked from v3.1.1 with continued maintenance and React 19 support.