用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill react-hooks命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | react-hooks |
| description | Best practices for React Hooks usage and custom hook creation. Use when this capability is needed. |
| metadata | {"author":"fierzone"} |
Effective usage of React Hooks.
useEffect: Sync with external systems ONLY. Cleanup required.useRef: Mutable state without re-renders (DOM, timers, tracking).useMemo/Callback: Measure first. Use for stable refs or heavy computation.use*.useLatest pattern (ref) for event handlers to avoid dependency changes.useTransition / useDeferredValue for non-blocking UI updates.useState(() => expensive()).why-did-you-render.// Custom Hook
function useWindowSize() {
const [size, setSize] = useState({ w: 0, h: 0 });
useEffect(() => {
function handleResize() {
setSize({ w: window.innerWidth, h: window.innerHeight });
}
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []); // Empty = mount only
return size;
}
// Lazy Init
const [state, setState] = useState(() => computeExpensiveValue());
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
基于 SOC 职业分类