React Router API Reference
    Preparing search index...

    Type Alias MiddlewareFunction<Result>

    MiddlewareFunction: (
        args: DataFunctionArgs<Readonly<RouterContextProvider>>,
        next: MiddlewareNextFunction<Result>,
    ) => MaybePromise<Result | void>

    Route middleware function signature. Receives the same "data" arguments as a loader/action (request, params, context) as the first parameter and a next function as the second parameter which will call downstream handlers and then complete middlewares from the bottom-up

    Type Parameters

    • Result = unknown

    Type declaration