github/awesome-copilot · react18-lifecycle-patterns · SKILL.md
React 18生命周期迁移模式
提供针对React 18.3.1的三种不安全类组件生命周期方法(componentWillMount、componentWillReceiveProps和componentWillUpdate)的精确前后迁移模式。当类组件需要迁移生命周期方法、在getDerivedStateFromProps与componentDidUpdate之间做选择、添加getSnapshotBeforeUpdate或修复React 18 UNSAFE_生命周期警告时,使用此技能。在编写任何生命周期迁移代码前务必使用此技能——不要凭记忆猜测模式,这里的决策树能防止最常见的迁移错误。
这是公开 Agent Skill 的中文说明,由采集翻译或编辑润色,完整内容以上游 SKILL.md 为准。适用于 Cursor / Claude Code / Codex / Gemini。 打开上游 SKILL.md
安装
通用(npx skills)
npx skills add github/awesome-copilot -s react18-lifecycle-patterns
Cursor
把该 Skill 复制到项目的 .cursor/skills/react18-lifecycle-patterns/ 目录
Claude Code
npx skills add github/awesome-copilot -a claude-code -s react18-lifecycle-patterns