Remix Utils - v9.3.1
    Preparing search index...

    Module Server/Redirect Back

    Note

    Install using bunx shadcn@latest add @remix-utils/redirect-back.

    This function is a wrapper of the redirect helper from Remix. Unlike Remix's version, this one receives the whole request object as the first value and an object with the response init and a fallback URL.

    The response created with this function will have the Location header pointing to the Referer header from the request, or if not available, the fallback URL provided in the second argument.

    import { redirectBack } from "remix-utils/redirect-back";

    export async function action({ request }: Route.ActionArgs) {
    throw redirectBack(request, { fallback: "/" });
    }

    This helper is most useful when used in a generic action to send the user to the same URL it was before.

    Functions

    redirectBack