← All recipes
Moderne licensed

Upgrade to React 18

Recipe IDorg.openrewrite.react.migrate.upgrade-to-react-18Artifact@openrewrite/recipes-react

Migrate deprecated APIs for React 18 compatibility. Includes all React 16 and 17 migrations plus the createRoot API migration, removal of unstable_batchedUpdates, unmountComponentAtNode replacement, and render callback removal.

Composite recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.react.migrate.upgrade-to-react-18

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-react

Definition

This recipe runs the following recipes in order.