I used react-router for navigation. I used props.history.push(url)
but it just appends the provided url in existing url.
Example- current URL of browser - http://my-app1.example.com:3000/about
Action to be performed - navigate to http://my-app2.example.com:3000/contactUs without refreshing the page.
To solve above problem I tried following piece of code.
let url = 'http://my-app2.example.com:3000/contactUs'
props.history.push(url)
Result-
Browser URL turns to http://my-app1.example.com:3000/about/http://my-app2.example.com:3000/contactUs
I tried using <Link />
still it didn't worked.
Possible solution is to use <a>
tag or use window.location.href = url
but it refreshes the page.
Finally, my requirement is to navigate to a url with different sub-domain without refreshing the page in a react web-app.
Could anyone suggest a possible solution for the same.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…