Current url holds data to display or show into view in segment query string. In this article, we will discuss about how to get current page url in react application. In this tutorial, I will show you reactjs get current page url example.
Javascript window.location.href
property holds the current url which you can use it into React. Let's see below example.
import React from 'react'
export default class Home extends React.Component{
render() {
const currentUrl = window.location.href;
return(
<p>
{ currentUrl }
</p>
);
}
}
This way you can get current url into React application. I hope it will help you.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel 8 - Ajax CRUD With yajra Datatable and Bootstrap Model Validation Example
In this article, I will share with your...jQuery sliding effect example
In this article, we will describe on sli...How to Convert Comma Separated String into an Array in JavaScript
Use the split() Method You can use th...Convert HTML to PDF in Laravel 8 with Dompdf
Hello guys, in accounting or ecommerce a...How to Build a Chrome Extension
Extensions in Google chrome and Add-ons...