React Router API Reference
    Preparing search index...

    Interface DataStrategyFunctionArgs<Context>

    interface DataStrategyFunctionArgs<Context = DefaultContext> {
        context: Context;
        fetcherKey: null | string;
        matches: DataStrategyMatch[];
        params: Params;
        request: Request;
        runClientMiddleware: (
            cb: DataStrategyFunction<Context>,
        ) => Promise<Record<string, DataStrategyResult>>;
        unstable_pattern: string;
    }

    Type Parameters

    • Context = DefaultContext

    Hierarchy

    • DataFunctionArgs<Context>
      • DataStrategyFunctionArgs
    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.

    fetcherKey: null | string

    The key of the fetcher we are calling dataStrategy for, otherwise null for navigational executions

    Matches for this route extended with Data strategy APIs

    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.

    runClientMiddleware: (
        cb: DataStrategyFunction<Context>,
    ) => Promise<Record<string, DataStrategyResult>>
    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.