Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // webpack.config.js
- new Webpack.DefinePlugin({
- BASENAME: '/users'
- })
- // somewhere in your application
- import { useRouterHistory } from 'react-router'
- import { createHistory } from 'history'
- const history = useRouterHistory(createHistory)({
- basename: BASENAME
- })
- plugins: [
- new webpack.DefinePlugin({
- BASENAME: JSON.stringify("/")
- })
- ],
- plugins: [
- new webpack.DefinePlugin({
- BASENAME: JSON.stringify("/users/")
- }),
- import { Router, Route, IndexRoute, browserHistory } from 'react-router';
- import { useBasename } from 'history'
- ...
- <Router history={useBasename(() => browserHistory)({ basename: BASENAME })}>
Add Comment
Please, Sign In to add comment