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...
- How to Reactive Forms with Validation in Angular 18?
- Reactjs Props Example With Function and Class Components
- React Color Picker Example With Change Event
- How to Hide and Show Multiple Div in React ?
- React js File Upload Example With Axios
- How to Resize, Crop, Compress Images Before Uploading In ReactJS?
- How to Send Data From React to Node JS Express?
- Reactjs String Replace Example