How to get Current Page URL in ReactJs ?

React.js

Nicesnippets

693

10-11-2020


How to get Current Page URL in ReactJs ?

Now let's see example of get current url in reactjs. We will talk about how to get current page url in reactjs. In this tutorial, I will show you reactjs get current page url example. I will give you simple and easy way to get current url in reactjs.

Here I will give you full example for how to get current page url in reactjs. So let's see the bellow example.

Example


import React from 'react'

export default class Home extends React.Component{

render(){

const currentUrl = window.location.href;

return(

<div>

{currentUrl}

</div>

);

}

}

it will help you...


Recommended Posts