ReactDOM.render(
<Provider>
<Router basename={config.baseUrl}>
<App />
</Router>
</Provider>,
document.getElementById('root'),
);
// @flow
import React from 'react';
import { Switch, Route, Redirect, Link, withRouter } from 'react-router-dom';
import { compose } from 'recompose';
import Header from './Header';
import Main from './Main';
import Footer from './Footer';
import Alert from './Common/Alert';
import { connect } from '../store';
const App = ({
isMobile, location, buyCompletionStep,
}): React.Element<*> => {
console.log(location);
return (
<div>
<div className="wrapper">
<div className="base">
<div className="main_content">
<Header />
<HeaderWarning />
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/buy">Buy</Link></li>
<li><Link to="/sell">Sell</Link></li>
<li><Link to="/help">Help</Link></li>
<li><Link to="/test">test</Link></li>
<li><Link to="/done">Done</Link></li>
</ul>
<Switch>
<Route
exact
path="/"
component={() => (
<Main />
)}
/>
<Route
exact
path="sell"
render={() => (
<h1>Sell</h1>
)}
/>
<Route
exact
path="help"
render={() => (
<h1>Help</h1>
)}
/>
<Route
exact
path="/test"
render={() => (
<h1>Test</h1>
)}
/>
<Redirect to="/" />
</Switch>
<Footer />
</div>
</div>
</div>
<Alert code={buyCompletionStep} />
</div>
);
};
export default compose(
withRouter,
connect(state => ({
lang: state.lang,
isMobile: state.isMobile,
buyCompletionStep: state.buyCompletionStep,
})),
)(App);
Result console.log(location): // {pathname: "/", search: "", hash: "", state: undefined}
and not changed by click on links but real url of browser changed