[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFX4YEXEFNDWF0GYC6HBKS":3,"skill-same:01M6EFX4YEXEFNDWF0GYC6HBKS":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6EFX4YEXEFNDWF0GYC6HBKS","preact",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fpreact\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# Preact — Fast 3kB Alternative to React\n\nYou are an expert in Preact, the lightweight React alternative with the same modern API in just 3kB. You help developers build performant web applications using Preact's component model, hooks, signals for reactive state, and compat layer for React ecosystem compatibility — ideal for performance-critical apps, embedded widgets, and mobile web where bundle size matters.\n\n## Core Capabilities\n\n### Components and Hooks\n\n```tsx\nimport { h, render } from \"preact\";\nimport { useState, useEffect, useRef, useMemo } from \"preact\u002Fhooks\";\n\nfunction TodoApp() {\n  const [todos, setTodos] = useState\u003C{ id: number; text: string; done: boolean }[]>([]);\n  const [input, setInput] = useState(\"\");\n  const inputRef = useRef\u003CHTMLInputElement>(null);\n\n  const remaining = useMemo(() => todos.filter(t => !t.done).length, [todos]);\n\n  const addTodo = () => {\n    if (!input.trim()) return;\n    setTodos([...todos, { id: Date.now(), text: input, done: false }]);\n    setInput(\"\");\n    inputRef.current?.focus();\n  };\n\n  const toggle = (id: number) => {\n    setTodos(todos.map(t => t.id === id ? { ...t, done: !t.done } : t));\n  };\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>Todos ({remaining} remaining)\u003C\u002Fh1>\n      \u003Cinput ref={inputRef} value={input} onInput={e => setInput((e.target as HTMLInputElement).value)}\n        onKeyDown={e => e.key === \"Enter\" && addTodo()} \u002F>\n      \u003Cbutton onClick={addTodo}>Add\u003C\u002Fbutton>\n      \u003Cul>\n        {todos.map(t => (\n          \u003Cli key={t.id} style={{ textDecoration: t.done ? \"line-through\" : \"none\" }}\n            onClick={() => toggle(t.id)}>{t.text}\u003C\u002Fli>\n        ))}\n      \u003C\u002Ful>\n    \u003C\u002Fdiv>\n  );\n}\n\nrender(\u003CTodoApp \u002F>, document.getElementById(\"app\")!);\n```\n\n### Signals (Fine-Grained Reactivity)\n\n```tsx\nimport { signal, computed, effect } from \"@preact\u002Fsignals\";\n\n\u002F\u002F Global reactive state — no context providers needed\nconst count = signal(0);\nconst doubled = computed(() => count.value * 2);\n\n\u002F\u002F Effects run when dependencies change\neffect(() => {\n  document.title = `Count: ${count.value}`;\n});\n\nfunction Counter() {\n  \u002F\u002F Signal directly in JSX — only this text node updates, not entire component\n  return (\n    \u003Cdiv>\n      \u003Cp>Count: {count}\u003C\u002Fp>\n      \u003Cp>Doubled: {doubled}\u003C\u002Fp>\n      \u003Cbutton onClick={() => count.value++}>+\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F No re-render of Counter component — signal updates the DOM text node directly\n```\n\n### React Compatibility\n\n```tsx\n\u002F\u002F preact\u002Fcompat provides React-compatible API\n\u002F\u002F In package.json or bundler config:\n\u002F\u002F \"alias\": { \"react\": \"preact\u002Fcompat\", \"react-dom\": \"preact\u002Fcompat\" }\n\n\u002F\u002F Now React libraries work with Preact:\nimport { useQuery } from \"@tanstack\u002Freact-query\";  \u002F\u002F Works!\nimport { motion } from \"framer-motion\";            \u002F\u002F Works!\n\n\u002F\u002F Most React component libraries work out of the box with the compat layer\n```\n\n## Installation\n\n```bash\n# New project\nnpm create preact                          # Official CLI\n\n# Add to existing Vite project\nnpm install preact\n# vite.config.ts: alias { \"react\": \"preact\u002Fcompat\", \"react-dom\": \"preact\u002Fcompat\" }\n\n# Signals\nnpm install @preact\u002Fsignals\n```\n\n## Best Practices\n\n1. **Signals for state** — Use `@preact\u002Fsignals` for shared state; no Context needed, fine-grained DOM updates\n2. **React compat for ecosystem** — Alias `react` to `preact\u002Fcompat`; use React component libraries without modification\n3. **3kB advantage** — Preact shines in performance-critical contexts: embedded widgets, mobile web, slow connections\n4. **Same API as React** — useState, useEffect, useRef, useMemo all work identically; easy migration\n5. **No synthetic events** — Preact uses native DOM events; slightly different from React's event system\n6. **Prerender for SSG** — Use `preact-render-to-string` for server rendering; or use Fresh (Deno) for full SSR\n7. **HTM for no-build** — Use `htm` tagged template literals instead of JSX; works without a build step\n8. **Bundle analysis** — Compare with React: Preact (3kB) vs React+ReactDOM (42kB); Preact wins on initial load\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fpreact",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill preact",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill preact",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill preact","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fpreact\u002FSKILL.md",true,[],[46,55,64,73,79,85],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[52,53,54],"model","model hierarchy","model hierarchy skill",{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[61,62,63],"MCP","zoom","zoom mcp",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[70,71,72,62],"sdk","zoom apps sdk","apps",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[75],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[87]]