Sometimes, we want to set window.location
with TypeScript.
in this article, we’ll look at how to set window.location
with TypeScript.
How to set window.location with TypeScript?
To set window.location
with TypeScript, we can set the window.location.href
property to the URL path we want to go to.
For instance, we write
window.location.href = "/url";
to navigate to the /url
URL by setting window.location.href
to the URL string.
Conclusion
To set window.location
with TypeScript, we can set the window.location.href
property to the URL path we want to go to.