Skip to main content
Version: 11.x

Function: experimental_redirect()

experimental_redirect(url, redirectType?): undefined

Defined in: packages/server/src/adapters/next-app-dir/redirect.ts:27

Like next/navigation's redirect() but throws a TRPCError that later will be handled by Next.js This provides better typesafety than the next/navigation's redirect() since the action continues to execute on the frontend even if Next's redirect() has a return type of never.

Parameters

ParameterType
urlstring | URL
redirectType?RedirectType

Returns

undefined

Remark

You should only use this if you're also using nextAppDirCaller.