Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get current url react router

import {withRouter} from 'react-router-dom';

const SomeComponent = withRouter(props => <MyComponent {...props}/>);

class MyComponent extends React.Component {
  SomeMethod () {
    const {pathname} = this.props.location;
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #current #url #react #router
ADD COMMENT
Topic
Name
8+7 =