TanStackT
TanStack2y ago
2 replies
generous-coffee

Navigate to an external url prob

Hello, I'm encountering this problem while trying to redirect the user to an external URL in the loader function.
This is my logic:
Fetching products.
If the returned list is empty, I will redirect the user to the external URL.
I've tried using "throw redirect/navigate," but it hasn't worked.

if (!products.length) {
throw redirect({ to: https://externalurl.com/ });
}

error => Error: Invariant failed: Attempting to navigate to external url with this.navigate!
Was this page helpful?