Guest User

Untitled

a guest
Jan 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. // webpack.config.js
  2. new Webpack.DefinePlugin({
  3. BASENAME: '/users'
  4. })
  5.  
  6. // somewhere in your application
  7. import { useRouterHistory } from 'react-router'
  8. import { createHistory } from 'history'
  9.  
  10. const history = useRouterHistory(createHistory)({
  11. basename: BASENAME
  12. })
  13.  
  14. plugins: [
  15. new webpack.DefinePlugin({
  16. BASENAME: JSON.stringify("/")
  17. })
  18. ],
  19.  
  20. plugins: [
  21. new webpack.DefinePlugin({
  22. BASENAME: JSON.stringify("/users/")
  23. }),
  24.  
  25. import { Router, Route, IndexRoute, browserHistory } from 'react-router';
  26. import { useBasename } from 'history'
  27. ...
  28. <Router history={useBasename(() => browserHistory)({ basename: BASENAME })}>
Add Comment
Please, Sign In to add comment