Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.31 KB

File metadata and controls

60 lines (47 loc) · 1.31 KB

remove-with-props

Usage

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

Local Usage

node ./bin/cli.js remove-with-props path/of/files/ or/some**/*glob.js

Input / Output


basic

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>
  );
};