Skip to content
HN On Hacker News ↗

Production-ready hooks for Preact | kamod-hooks

▲ 8 points 1 comments by zahir777 2w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully AI-generated

99 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 2
SEGMENTS · AI 2 of 2
WORD COUNT 301
PEAK AI % 99% · §1
Analyzed
Jun 27
backend: pangram/v3.3
Segments scanned
2 windows
avg 151 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 301 words · 2 segments analyzed

Human AI-generated
§1 AI · 99%

A lightweight collection of typed, tree-shakeable hooks built specifically for Preact.kamod-hooksPreact-first · Typed · Tree-shakeableRetro docs, modern hooksShip Preact features faster with production-ready hooks.Start with setup, verify behavior in live demos, and copy implementation-ready hook patterns with published TypeScript signatures.78documented hooks81live demos0runtime deps in coreInstallpnpm add @kamod-ch/hooks preactPreview the docs experienceTest a real hook, inspect the exact source, and confirm the API shape before you implement it.LiveReal interactive stateExactCopy the shown sourceTypedMatch the published packageLayout: listimport { useToggle } from '@kamod-ch/hooks'

export default function UseToggleDemo() { const [value, actions] = useToggle('list', 'grid')

return ( <div> <p><strong>Layout:</strong> {value}</p> <div class="demo-actions"> <button type="button" onClick={actions.toggle}>Toggle</button> <button type="button" onClick={actions.setLeft}>Set list</button> <button type="button" onClick={actions.setRight}>Set grid</button> </div> </div> ) }

Why kamod-hooksFocused on practical Preact usageThe library mirrors the real implementation in packages/core and keeps the docs grounded in shippable examples.PXPreact-firstHooks are authored for Preact instead of wrapping a React-focused API surface.TSTyped by defaultDistributed declarations stay aligned with implementation and generated docs output.APITree-shakeable exportsImport from the main package or use per-hook subpaths without extra runtime cost.WEBBrowser-native hooksStorage, observers, fullscreen, WebSocket, and URL state are covered with concrete examples. How it worksGo from overview to code quicklyUse the docs like a template: start with the guide, verify behavior in a demo, then copy the exact source shape you need.01Read the guideInstall the package, choose an import style, and review SSR notes before implementation.02Test a live exampleUse an interactive demo to validate behavior, defaults, and edge cases before shipping.03Copy the exact APIUse the page signature and demo source as the baseline for production usage.

§2 AI · 99%

ExploreMove from overview to implementation detailsStart with the guide, scan the full hooks index, or jump directly to the exported utilities. Start with the docs, then ship faster.Use the getting-started guide for setup, then jump into the hook pages for demos, signatures, and implementation-ready examples.