I want to redirect users in NextJS similar to how you can use useNavigate(). <Link /> is not good enough for this, because I want the user to be immediately redirected.
CodePudding user response:
I suppose you would be looking for the useRouter hook to access the router object and issue an imperative navigation action.
Example:
const router = useRouter();
...
router.replace(targetInAppUrl);
See router.push or router.replace for more details.
