Kamod Hooks – a Preact hooks library ported from ahooks

(kamod-ch.github.io)

5 points | by zahir777 3 days ago ago

1 comments

  • zahir777 3 days ago

    Hi HN,

    I built Kamod Hooks, a Preact hooks library inspired by and ported from ahooks.

    The goal is to bring a broad set of practical React-style hooks to the Preact ecosystem, while keeping the package lightweight and Preact-native.

    Repo: https://github.com/kamod-ch/kamod-hooks

    Some details:

    - Preact-only peer dependency

    - No runtime npm dependencies in @kamod-hooks/core

    - ESM + TypeScript build

    - Per-hook subpath imports, e.g. @kamod-hooks/core/useToggle

    - Browser-native APIs where possible: ResizeObserver, IntersectionObserver, Fullscreen API, URLSearchParams, History API

    - Hooks for async requests, debounce/throttle, localStorage/sessionStorage, URL state, virtual lists, WebSocket, drag/drop, responsive breakpoints, theme handling, and more

    I started this because I often use Preact for small, fast frontend projects, but many useful hook libraries are still React-first. Kamod Hooks is meant to fill that gap without pulling in React-specific assumptions like react-router.

    It is still early, so I would especially appreciate feedback on:

    - API compatibility with ahooks

    - Which hooks are most important for real-world Preact projects

    - Bundle/tree-shaking behavior

    - Missing docs or examples

    - Whether the package structure feels right

    Thanks!