React 旧 Context 迁移

原名:react18-legacy-context

把 React 旧版 contextTypes 等模式迁移到现代 Context API。

中文 Skills 技能说明

适合 React 18 以上项目清理遗留上下文代码。先定位提供者、消费者和测试,再分阶段迁移并验证渲染行为;不要一次性删除旧路径导致第三方组件失效。

上游能力依据

上游原始适用说明:Provides the complete migration pattern for React legacy context API (contextTypes, childContextTypes, getChildContext) to the modern createContext API. Use this skill whenever migrating legacy context in class components - this is always a cross-file migration requiring the provider AND all consumers to be updated together. Use it before touching any contextTypes or childContextTypes code, because migrating only the provider without the consumers (or vice versa) will cause a runtime failure. Always read this skill before writing any context migration - the cross-file coordination steps here prevent the most common context migration bugs.

上游 SKILL.md 主要章节(保留原文标题):

使用边界

先读取项目约定、依赖版本和现有测试,再提出最小改动。写文件、运行脚本、提交代码或发布前应检查差异并保留回退路径。

作者、翻译与许可证

原作者
GitHub, Inc. 与 awesome-copilot contributors
中文翻译
CEOFans翻译
许可证
MIT
上游来源
https://github.com/github/awesome-copilot/tree/3f0bba475ec40b9680e1d0311b9caffeec5ad4c3/skills/react18-legacy-context

适用范围

平台:linux、macos、windows;标签:软件开发、React 旧 Context 迁移

安全提示

基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。

如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。