← All recipes
Moderne licensed

Replace defaultProps with default parameter values

Recipe IDorg.openrewrite.react.19.replace-default-propsArtifact@openrewrite/recipes-react

Converts Component.defaultProps = {...} to ES6 default parameter values in function components. defaultProps for function components is deprecated in React 19.

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.19.replace-default-props

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

mod config recipes npm install @openrewrite/recipes-react