Skip to main content

react19-source-patterns

Reference for React 19 source-file migration patterns, including API changes, ref handling, and context updates.

来源信息

仓库
github/awesome-copilot
最近来源活动
2026年4月9日 05:18
检测到的 SKILL.md 语言
英语
星标
39,919
分支
5,097

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
react19-source-patterns
description
Reference for React 19 source-file migration patterns, including API changes, ref handling, and context updates.
# React 19 Source Migration Patterns Reference for every source-file migration required for React 19. ## Quick Reference Table | Pattern | Action | Reference | |---|---|---| | `ReactDOM.render(...)` | → `createRoot().render()` | See references/api-migrations.md | | `ReactDOM.hydrate(...)` | → `hydrateRoot(...)` | See references/api-migrations.md | | `unmountComponentAtNode` | → `root.unmount()` | Inline fix | | `ReactDOM.findDOMNode` | → direct ref | Inline fix | | `forwardRef(...)` wrapper | → ref as direct prop | See references/api-migrations.md | | `Component.defaultProps = {}` | → ES6 default params | See references/api-migrations.md | | `useRef()` no arg | → `useRef(null)` | Inline fix add `null` | | Legacy Context | → `createContext` | [→ api-migrations.md#legacy-context](references/api-migrations.md#legacy-context) | | String refs `this.refs.x` | → `createRef()` | [→ api-migrations.md#string-refs](references/api-migrations.md#string-refs) | | `import React from 'react'` (unused) | Remove | Only if no `React.` usage in file | ## PropTypes Rule Do **not** remove `.propTypes` assignments. The `prop-types` package still works as a standalone validator. React 19 only removes the built-in runtime checking from the React package the package itself remains valid. Add this comment above any `.propTypes` block: ```jsx // NOTE: React 19 no longer runs propTypes validation at runtime. // PropTypes kept for documentation and IDE tooling only. ``` ## Read the Reference For full before/after code for each migration, read **`references/api-migrations.md`**. It contains the complete patterns including edge cases for `forwardRef` with `useImperativeHandle`, `defaultProps` null vs undefined behavior, and legacy context provider/consumer cross-file migrations.
在 GitHub 查看