React 字符串 Ref 迁移

原名:react18-string-refs

把旧式字符串 Ref 迁移为 createRef、回调 Ref 或现代模式。

中文 Skills 技能说明

适合 React 旧项目升级。先查找 this.refs 的全部使用和生命周期依赖,再小步修改;迁移后验证焦点、测量和第三方组件交互。

上游能力依据

上游原始适用说明:Provides exact migration patterns for React string refs (ref="name" + this.refs.name) to React.createRef() in class components. Use this skill whenever migrating string ref usage - including single element refs, multiple refs in a component, refs in lists, callback refs, and refs passed to child components. Always use this skill before writing any ref migration code - the multiple-refs-in-list pattern is particularly tricky and this skill prevents the most common mistakes. Use it for React 18.3.1 migration (string refs warn) and React 19 migration (string refs removed).

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

使用边界

先核对上游说明、依赖、输入资料和所需权限。涉及写入、删除、发布、支付或外部发送时,必须在执行前人工确认。

作者、翻译与许可证

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

适用范围

平台:linux、macos、windows;标签:设计与前端、React 字符串 Ref 迁移

安全提示

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

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