React Router/5.1/Component Render To Children

/icons/calendar.svg

Last update

Nov 4, 2024

This codemod transforms Route components using render and component props into JSX with nested children.

Before

Using render:

<Route path="/example" render={() => <MyComponent />} />

Using component:

<Route path="/example" component={MyComponent} />

After

Converted render:

<Route path="/example">
<MyComponent />
</Route>

Converted component:

<Route path="/example">
<MyComponent />
</Route>

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now