daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Jan 16th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 })}>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top