npx react-router-v4-codemods create-hash-history path/of/files/ or/some**/*glob.js
# or
yarn global add react-router-v4-codemods
react-router-v4-codemods create-hash-history path/of/files/ or/some**/*glob.js
node ./bin/cli.js create-hash-history path/of/files/ or/some**/*glob.js
Input (basic.input.js):
import { Router, hashHistory } from 'react-router';
const MyApp = () => (
<Router history={hashHistory}>
<Route path="/posts" component={PostList} />
</Router>
);
Output (basic.output.js):
const history = createHashHistory();
import createHashHistory from 'history/createHashHistory';
import { Router, hashHistory } from 'react-router';
const MyApp = () => (
<Router history={history}>
<Route path="/posts" component={PostList} />
</Router>
);