mcpField
R
react-hooks

react-hooks

github.com/full-stack-skillsDevelopment2157 installsUpdated 5w ago
Repository

About react-hooks

A guide to managing state and side effects with React Hooks, covering built-in and custom hooks alongside common rules. It is for React developers addressing dependencies, cleanup, and closure-related issues.

Key features

  1. 01Cover useState, useEffect, and useContext
  2. 02Include useRef, useMemo, and useCallback
  3. 03Explain useReducer and useLayoutEffect
  4. 04Describe custom hook naming and call rules
  5. 05Emphasize complete dependencies and cleanup

Use cases

  1. 01Manage component state and side effects with hooks
  2. 02Write reusable custom hooks
  3. 03Review dependency arrays and subscription cleanup

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/full-stack-skills/react-skills --skill react-hooks

After installing, type/react-hooksin Claude Code to confirm it loaded.

Bundled filesagents/openai.yamlLICENSE.txt

Details

From the project README

When to use this skill

Use this skill whenever the user wants to:

  • 用 React Hooks(useState、useEffect、useContext、自定义)管理状态与副作用
  • 遵循 Hooks 规则与最佳实践、避免闭包与依赖问题

How to use this skill

  1. 基础:useState、useEffect(依赖数组、清理函数);useContext、useRef。
  2. 进阶:useMemo、useCallback、自定义 Hook;useReducer、useLayoutEffect。
  3. 参考:https://react.dev/reference/react

Best Practices

  • 依赖数组完整;清理订阅与定时器。
  • 自定义 Hook 命名 useXxx;避免条件/循环中调 Hook。

Keywords

React Hooks, useState, useEffect, 自定义 Hook

Comments

Markdown supported