← All recipes
Moderne licensed

Remove implicit ref callback returns

Recipe IDorg.openrewrite.react.19.no-implicit-ref-callback-returnArtifact@openrewrite/recipes-react

In React 19, ref callbacks can return cleanup functions. Arrow functions with expression bodies implicitly return values, which React would interpret as cleanup functions. This recipe wraps them in block bodies.

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.no-implicit-ref-callback-return

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

mod config recipes npm install @openrewrite/recipes-react