React Router/7/Route Wildcard To Nested

1.0.1Last update Dec 17, 2024
by@manishjha-04

This transformation updates the routing structure for multi-segment splat paths. It affects both createBrowserRouter configurations and components.

Before

createBrowserRouter([
{ path: '/', element: < Home / > },
{
path: 'dashboard/*',
element: < Dashboard / > ,
},
]);

After

createBrowserRouter([
{ path: '/', element: < Home / > },
{
path: 'dashboard',
children: [{
path: '*',
element: < Dashboard / > ,
}, ],
},
]);

Build custom codemods

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

background illustrationGet Started Now