React Router API Reference
    Preparing search index...

    Variable redirectConst

    redirect: RedirectFunction = ...

    A redirect Response. Sets the status code and the Location header. Defaults to 302 Found.

    import { redirect } from "react-router";

    export async function loader({ request }: Route.LoaderArgs) {
    if (!isLoggedIn(request))
    throw redirect("/login");
    }

    // ...
    }

    @public

    framework

    data

    The URL to redirect to.

    The status code or a ResponseInit object to be included in the response.

    A Response object with the redirect status and Location header.