# Upgrade React 18 to React 19

An agent moves the Cypress Real World App to React 19.3.1, bumps three libraries whose peers refused 19, and types, unit tests, lint and build pass as before.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-framework-major/react-18/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent follows the guide's order on cypress-io/cypress-realworld-app. It moves react 18.2.0 to 18.3.1, the warning release, and finds no deprecation warnings. It then installs React 19 with `@types/react` 19, `@types/react-dom` 19 and `@testing-library/react` 16, adding `@testing-library/dom`, now a separate dependency. A search of `src` and `cypress` for removed APIs finds nothing to change: every entry file already uses `createRoot`.

It then bumps the libraries whose peer range excluded 19: `@auth0/auth0-react` 2.2.4 to 2.30.0, `react-virtualized` 9.22.5 to 10.0.0, and `react-number-format` 4.9.4 to 5, renaming `NumberFormat` to `NumericFormat` and `isNumericString` to `valueIsNumericString` in `TransactionCreateStepTwo.tsx`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade this app from React 18 to React 19 following the official upgrade guide step by step. Run the tests after each step and fix what breaks. Open a pull request that lists each change and anything you left for a person to decide.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on cypress-io/cypress-realworld-app at 0729f68: 4 files changed, 132 insertions(+), 475 deletions(-) in `package.json`, `yarn.lock`, `TransactionCreateStepTwo.tsx` and the deleted `patches/react-virtualized+9.22.5.patch`. `yarn types`, `yarn vite build` and `yarn lint` exited 0, and `yarn test:unit:ci` ended `Tests  44 passed | 10 skipped (54)` before and after. `npx cypress run --component` exited 1 with `✖  1 of 5 failed (20%)` on both trees: `TransactionDateRangeFilter.cy.tsx:37` times out expecting `Jan, 1 2018`, a failure that predates the upgrade. The e2e suite was not run, and no pull request was opened.

For the reviewer: `@xstate/react` 3.2.2 has no React 19 range, and fixing it means xstate 5 and a rewrite of every machine; `@matheusluizn/react-google-login` allows only React 18 and is used by `src/index.google.tsx` alone. Neither `react-virtualized` 10 nor `react-number-format` 5 is covered by a test the run executed.

## Run it on every Monday until the upgrade merges

An automation with a `schedule` trigger, `cron` `0 9 * * 1`, runs this prompt weekly in the Project, so a team that is not ready to merge gets a fresh attempt against the latest React 19 and peer releases. Switch it off once the pull request lands.

## Why run it on Rush?

The React bump itself changed no source. The work was in the libraries around it, and the run caught one that is easy to miss: the local patch for `react-virtualized` 9.22.5 no longer applied, because the file it edited does not exist in 10.0.0. It deleted the patch and noted that `patch-package` now prints "No patch files found".

## Frequently asked questions

### Did the agent run the React 19 codemods?

No. It skipped `types-react-codemod` because `tsc` was already clean after the type packages moved to 19, and the removed-API search found nothing to change.

### Why does running the tests touch data/database.json?

The unit tests rewrite that tracked file. The agent restored it with `git checkout` after each run, so it is not in the diff.

## The same job on other stacks

- [Upgrade Spring Boot 2.6 to Spring Boot 4](https://getrush.ai/run/upgrade-framework-major/spring-boot-2/)
- [Upgrade Laravel 11 to Laravel 13](https://getrush.ai/run/upgrade-framework-major/laravel/)
- [Upgrade Next.js 13 to Next.js 16](https://getrush.ai/run/upgrade-framework-major/nextjs/)
- [Upgrade Phoenix 1.7 to Phoenix 1.8](https://getrush.ai/run/upgrade-framework-major/phoenix/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade Gatsby and Its Plugins](https://getrush.ai/run/upgrade-gatsby/gatsby/)
- [Upgrade Go Modules Weekly for a Cobra CLI](https://getrush.ai/run/upgrade-go-modules/cobra/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
