'How to get current url and base url in reactjs?

Now im working on a project, but i can't get current url or base url in react. i need to get url and base url in react for active open tab when im in specific route.



Solution 1:[1]

You can access to the active url and some other informations about location in your component through his props :

this.props.match

or props.match if you use functional components

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Guillaume