Skip to content
Skillpedia
Websites & UI (frontend)40k · #7390

react19-source-patterns

What it does

This guide helps you update your React code for version 19. It shows how to change specific code parts that stopped working or moved in the new version.

When to use it

  • ✓When updating your React project to version 19.
  • ✓When a part of your React code stops working after the update.
  • ✓To understand necessary changes in specific files.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/react19-source-patterns/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/react19-source-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“How do I update ReactDOM.render for React 19?”

5 new skills a week. 1 minute to read.

How it works

The AI compares your old code with React 19's migration patterns. It suggests the exact changes needed for each code part, like replacing `ReactDOM.render` with `createRoot().render()`.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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
String refs this.refs.x → createRef() → 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:

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

FAQ

Do I need to remove `.propTypes`?

No, you don't need to remove `.propTypes`. They still work as validators, but React 19 no longer runs them automatically. It's good to keep them for documentation and tooling.

What are 'String refs'?

These are an old way to reference elements in React (e.g., `this.refs.myElement`). React 19 suggests using `createRef()` instead.

What about `useRef()` with no argument?

If you use `useRef()` without an initial value, React 19 asks you to add `null` as the argument, making it `useRef(null)`.

Details

Original description by the author

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

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#7390
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills