I am trying to use the response-router-dom 4.0.0 library. But he sent me this error
Uncaught TypeError: Cannot read property 'location' undefined
There seems to be a problem in the browser. I used to use the 2.xx reactive router, and everything was fine. This is my index.js
import 'babel-polyfill' import React from 'react' import { Router, hashHistory } from 'react-router-dom' import { render } from 'react-dom' import { Provider } from 'react-redux' import { configureStore } from './store' import { routes } from './routes' const store = configureStore() render( <Provider store={store}> <Router history={hashHistory} routes={routes} /> </Provider>, document.getElementById('root') )
These are my routes.
import React from 'react' import { IndexRoute, Route } from 'react-router-dom' import App from './containers/App' import Main from './containers/Main' import First from './containers/First' export const routes = ( <Route path='/' component={Main}> <Route path='/path' component={First} /> <IndexRoute component={App} /> </Route> )
And also for server side expression, I set this receive configuration
app.get('*', function root(req, res) { res.sendFile(__dirname + '/index.html'); });
source share