mcpField
R
react19-source-patterns

react19-source-patterns

github.com/githubDevelopment40.5k968 installsUpdated today
Repository

About react19-source-patterns

react19-source-patterns is a migration reference for developers updating source files to React 19. It maps legacy APIs and patterns to replacements, with detailed examples available in a companion reference.

Key features

  1. 01Map legacy APIs to React 19 replacements
  2. 02Update rendering and hydration calls
  3. 03Replace legacy refs and context patterns
  4. 04Preserve propTypes with an explanatory comment

Use cases

  1. 01Plan a React 19 source migration
  2. 02Replace deprecated DOM APIs
  3. 03Update components using forwardRef or defaultProps

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/github/awesome-copilot --skill react19-source-patterns

After installing, type/react19-source-patternsin Claude Code to confirm it loaded.

Bundled filesreferences/api-migrations.md

Details

From the project README

React 19 Source Migration Patterns

Reference for every source-file migration required for React 19.

Quick Reference Table

PatternActionReference
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 refInline fix
forwardRef(...) wrapper→ ref as direct propSee references/api-migrations.md
Component.defaultProps = {}→ ES6 default paramsSee references/api-migrations.md
useRef() no arg→ useRef(null)Inline fix add null
Legacy Context→ createContext→ api-migrations.md#legacy-context
String refs this.refs.x→ createRef()→ api-migrations.md#string-refs
import React from 'react' (unused)RemoveOnly 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:

// 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.

Comments

Markdown supported