惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS Blog

Hacker News

GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Bonsai 1-bit WebGPU - a Hugging Face Space by webml-community Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line
Production-ready hooks for Preact | kamod-hooks
2026-06-24 · via Hacker News

A lightweight collection of typed, tree-shakeable hooks built specifically for Preact.

kamod-hooksPreact-first · Typed · Tree-shakeable

Retro docs, modern hooks

Ship 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 hooks

81live demos

0runtime deps in core

Install

pnpm add @kamod-ch/hooks preact

Preview the docs experience

Test a real hook, inspect the exact source, and confirm the API shape before you implement it.

LiveReal interactive state

ExactCopy the shown source

TypedMatch the published package

import { 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-hooks

Focused on practical Preact usage

The library mirrors the real implementation in packages/core and keeps the docs grounded in shippable examples.

PX

Preact-first

Hooks are authored for Preact instead of wrapping a React-focused API surface.

TS

Typed by default

Distributed declarations stay aligned with implementation and generated docs output.

API

Tree-shakeable exports

Import from the main package or use per-hook subpaths without extra runtime cost.

WEB

Browser-native hooks

Storage, observers, fullscreen, WebSocket, and URL state are covered with concrete examples.

How it works

Go from overview to code quickly

Use the docs like a template: start with the guide, verify behavior in a demo, then copy the exact source shape you need.

  1. 01

    Read the guide

    Install the package, choose an import style, and review SSR notes before implementation.

  2. 02

    Test a live example

    Use an interactive demo to validate behavior, defaults, and edge cases before shipping.

  3. 03

    Copy the exact API

    Use the page signature and demo source as the baseline for production usage.

Explore

Move from overview to implementation details

Start 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.