React Router API Reference
    Preparing search index...

    Interface LoaderFunctionArgs<Context>

    Arguments passed to loader functions

    interface LoaderFunctionArgs<Context = DefaultContext> {
        context: Context;
        params: Params;
        request: Request;
        unstable_pattern: string;
    }

    Type Parameters

    • Context = DefaultContext

    Hierarchy

    • DataFunctionArgs<Context>
      • LoaderFunctionArgs
    Index

    Properties

    context: Context

    This is the context passed in to your server adapter's getLoadContext() function. It's a way to bridge the gap between the adapter's request/response API with your React Router app. It is only applicable if you are using a custom server adapter.

    params: Params

    Dynamic route params for the current route.

    // app/routes.ts
    route("teams/:teamId", "./team.tsx"),

    // app/team.tsx
    export function loader({
    params,
    }: Route.LoaderArgs) {
    params.teamId;
    // ^ string
    }
    request: Request

    A Fetch Request instance which you can use to read headers (like cookies, and URLSearchParams from the request.

    unstable_pattern: string

    Matched un-interpolated route pattern for the current path (i.e., /blog/:slug). Mostly useful as a identifier to aggregate on for logging/tracing/etc.