const currentURL = window.location.href // returns the absolute URL of a page
const pathname = window.location.pathname //returns the current url minus the domain name
window.location.href
import {withRouter} from 'react-router-dom';
const SomeComponent = withRouter(props => <MyComponent {...props}/>);
class MyComponent extends React.Component {
SomeMethod () {
const {pathname} = this.props.location;
}
}