Cara mendapatkan URL saat ini dengan JavaScript atau React

const currentURL = window.location.href // returns the absolute URL of a page

const pathname = window.location.pathname //returns the current url minus the domain name
Terrible Teira