← All recipes
Moderne licensed

Replace ReactDOM.render with createRoot

Recipe IDorg.openrewrite.react.18.replace-reactdom-renderArtifact@openrewrite/recipes-react

Migrates from the legacy ReactDOM.render() API to the createRoot() API from react-dom/client introduced in React 18.

Single 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.18.replace-reactdom-render

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

mod config recipes npm install @openrewrite/recipes-react