React маршрутизатор получите хост JS

// use window.location which has the fields:
// host, hostname, href, origin, pathname, port, protocol

window.location.host // e.g. "localhost:3000"
window.location.hostname // e.g. "localhost"
window.location.href // e.g. "https://localhost:3000/your-path"
window.location.origin // e.g. "https://localhost:3000"
window.location.pathname // e.g. "/your-path"
window.location.port // e.g. "3000"
window.location.protocol // e.g. "https:"
Anxious Alligator