Type Alias GetLoadContextFunction<Env, Params, Data>

GetLoadContextFunction<Env, Params, Data>: ((args: {
    context: {
        cloudflare: EventContext<Env, Params, Data> & {
            caches: CacheStorage;
            cf: EventContext<Env, Params, Data>["request"]["cf"];
            ctx: {
                passThroughOnException: EventContext<Env, Params, Data>["passThroughOnException"];
                waitUntil: EventContext<Env, Params, Data>["waitUntil"];
            };
        };
    };
    request: Request;
}) => AppLoadContext | Promise<AppLoadContext>)

A function that returns the value to use as context in route loader and action functions.

You can think of this as an escape hatch that allows you to pass environment/platform-specific values through to your loader/action.

Type Parameters

  • Env = unknown
  • Params extends string = any
  • Data extends Record<string, unknown> = Record<string, unknown>