/react19-upgrade:react19-source-patternsfrom react19-upgrade
Migrates React source files from removed/changed APIs in React 19: root APIs, hydration, findDOMNode, forwardRef, defaultProps, useRef, legacy context, string refs, propTypes, and unused imports.
Ships in react19-upgrade. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Migrate React source files away from React 19 removed and changed APIs by choosing the right before/after pattern, preserving behavior, and summarizing the code-level transformations.
Keep createRef() available for class component refs, and migrate provider/consumer pairs together for legacy context.
| Pattern | Action | Reference |
|---|---|---|
ReactDOM.render(...) | Replace with createRoot().render(). | references/api-migrations.md |
ReactDOM.hydrate(...) | Replace with hydrateRoot(...). | references/api-migrations.md |
unmountComponentAtNode | Replace with root.unmount(). | Inline fix; keep or introduce a saved root reference. |
ReactDOM.findDOMNode | Replace with a direct ref. | Inline fix; refactor class components to hold DOM refs. |
forwardRef(...) wrapper | Prefer ref as direct prop when targeting React 19. | references/api-migrations.md |
Component.defaultProps = {} | Replace function component defaults with ES6 default params. | references/api-migrations.md |
useRef() no arg | Replace with useRef(null). | Inline fix: add null. |
| Legacy Context | Replace contextTypes, childContextTypes, and getChildContext with createContext. | references/api-migrations.md#legacy-context |
String refs this.refs.x | Replace with React.createRef() or callback refs. | references/api-migrations.md#string-refs |
import React from 'react' unused | Remove only when no React. usage remains in the file. | Verify per file. |
| API or pattern | Correct React 19 replacement | Verification |
|---|---|---|
ReactDOM.render(<App />, el) | import { createRoot } from 'react-dom/client'; const root = createRoot(el); root.render(<App />); | Confirm the root is created once per container. |
ReactDOM.hydrate(<App />, el) | import { hydrateRoot } from 'react-dom/client'; hydrateRoot(el, <App />); | Keep server-rendered markup assumptions intact. |
unmountComponentAtNode(container) | Save the root from createRoot(container) and call root.unmount(). | Refactor ownership if no root reference exists. |
findDOMNode(componentRef) | Attach a direct DOM ref and read ref.current. | Avoid replacing it with document queries. |
forwardRef | Accept ref as a direct prop for React 19 components. | Preserve useImperativeHandle behavior when present. |
Function defaultProps | Use parameter defaults or nullish coalescing. | Preserve null versus undefined behavior. |
useRef() | useRef(null) | Check any TypeScript type expectations. |
| Legacy context | React.createContext, provider value, and useContext or static contextType. | Migrate provider and consumers together. |
| String refs | React.createRef() fields or callback refs. | Pair ref="x" with this.refs.x. |
Do not remove .propTypes assignments just because React 19 stops running built-in runtime checking. The prop-types package still works as a standalone validator and remains useful for documentation and IDE tooling.
Add this comment above any .propTypes block that remains:
// NOTE: React 19 no longer runs propTypes validation at runtime.
// PropTypes kept for documentation and IDE tooling only.
references/api-migrations.md: complete before/after code for root APIs, findDOMNode, forwardRef with useImperativeHandle, defaultProps, useRef, legacy context, string refs, and unused React imports.import React from 'react' blindly: keep it when the file uses React.Component, React.createRef, React.createContext, React.useState, or any other React. API.defaultProps needs judgment: function component defaults are the primary removal target; preserve behavior for classes unless a safe refactor is clear.useImperativeHandle remains valid: only the forwardRef wrapper changes when ref becomes a prop.## React 19 source migration result
**Status:** migrated | planned | blocked
**Scope:** `<files or components>`
| File | Pattern | Replacement | Notes |
| --- | --- | --- | --- |
| `<path>` | `ReactDOM.render(...)` | `createRoot().render()` | `<root ownership>` |
### PropTypes
- `<file>`: kept with React 19 note | not present | removed for another justified reason
### Validation
- Migration scan: `<remaining hits or none>`
- Tests/build: `<command and result, or not run>`
references/api-migrations.md was consulted for non-trivial changes..propTypes assignments are preserved unless there is a separate, explicit reason to remove them.import React from 'react' lines are justified by React. usage; removed imports have no React. usage.useRef() calls in scope now pass an explicit initial value such as null.root.unmount().What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/react19-concurrent-patternsPreserve React 18 concurrent patterns and adopt React 19 APIs including useTransition, useDeferredValue, Suspense, use(), useOptimistic, useActionState, useFormStatus, and Actions. Use when reviewing React 19 migrations, auditing concurrent rendering, cleaning up Suspense data fetching, or adopting post-migration APIs./react19-test-patternsProvide before-and-after migration patterns for React 19 test compatibility, including act() imports, react-dom/test-utils removal, Simulate to fireEvent conversion, StrictMode call count changes, async act warnings, and custom render helper checks. Use when updating React test files for React 19.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin react19-upgradeOther plugins' skills for the same job