npx react-router-v4-codemods remove-with-props path/of/files/ or/some**/*glob.js
# or
yarn global add react-router-v4-codemods
react-router-v4-codemods remove-with-props path/of/files/ or/some**/*glob.js
node ./bin/cli.js remove-with-props path/of/files/ or/some**/*glob.js
Input (basic.input.js):
import withProps from 'recompose/withProps';
import Dashboard from './Dashboard';
const MyApp = ({ title }) => {
const DashboardWithTitle = withProps(Dashboard, { title });
return (
<Router history={history}>
<Route path="/" component={DashboardWithTitle} />
</Router>
);
};
Output (basic.output.js):
import withProps from 'recompose/withProps';
import Dashboard from './Dashboard';
const MyApp = ({ title }) => {
return (
<Router history={history}>
<Route path="/" render={(props) => {
return <Dashboard title={title} {...props} />;
}} />
</Router>
);
};