Read the Current full URL with React

  423 views   9 months ago React

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;
                { currentUrl }

This way you can get current url into React application. I hope it will help you.

Author : Harsukh Makwana
Harsukh Makwana

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]