Skip to content

Home

Redirect to URL

Redirects to a specified URL.

const redirect = (url, asLink = true) =>
  asLink ? (window.location.href = url) : window.location.replace(url);

redirect('https://google.com');

More like this

Start typing a keyphrase to see matching snippets.