How to get window URL using ReactJs ?

React.js

Nicesnippets

1436

20-04-2020


Hello Dev,

Many times we need website url. so how to get window url in react. react get url domain. react js get url path. if you want to get react js current browser url then it's simple.

Get Path With Domain

window.location.href

Get Path Without Domain

window.location.pathname

I hope it can help you...