Shivam Sahil
Shivam Sahil

Reputation: 4925

useNavigate: Navigate to external Link

on Clicking of a button, I want to perform an async operation and after that navigate user to an external website as shown below:

navigate("https://wwww.google.com?q=ABC")

But here's the problem:

while using navigate, my url changes like this, because for some reason it's assuming relative path:

http://localhost:3000/https://wwww.google.com?q=ABC

Can someone help me understand what is going wrong? I also tried setting replace to true but no luck there as well.

Upvotes: 8

Views: 19256

Answers (1)

Ashin Thankachan
Ashin Thankachan

Reputation: 158

window.location.href = "https://wwww.google.com?q=ABC";

Upvotes: 18

Related Questions