deepskill授权
React 旧版 Context 迁移
提供从 React 旧版 Context API(contextTypes、childContextTypes、getChildContext)迁移到现代 createContext API 的完整模式。当迁移类组件中的旧版 Context 时使用;这始终是跨文件迁移,需要同时更新提供者与全部消费者。在修改任何 contextTypes 或 childCon
↓ 0👍 0
◇ 来源证据已核对↗
从你要完成的任务出发,发现 Agent 技能。查看原始来源、了解使用说明,再选择下一步。
提供从 React 旧版 Context API(contextTypes、childContextTypes、getChildContext)迁移到现代 createContext API 的完整模式。当迁移类组件中的旧版 Context 时使用;这始终是跨文件迁移,需要同时更新提供者与全部消费者。在修改任何 contextTypes 或 childCon
依据类组件模式,将字符串 ref 和 this.refs 访问迁移为 React.createRef()。
提供诊断和修复 React 18 类组件自动批处理回归问题的准确模式。当类组件在异步方法、setTimeout、Promise 的 .then() 或 .catch()、原生事件处理程序中多次调用 setState 时使用。编写任何 flushSync 调用前先使用此技能;其中的决策树旨在防止不必要地过度使用 flushSync。也适用于修复升级 React
为三个不安全的类组件生命周期方法 componentWillMount、componentWillReceiveProps 和 componentWillUpdate 提供面向 React 18.3.1 的准确迁移前后模式。在类组件需要迁移生命周期方法、选择 getDerivedStateFromProps 还是 componentDidUpdate、添加