Function applyMiddleware

  • Apply middleware functions to a container.

    Middlewares are applied in array order, but execute in reverse order.

    Parameters

    Returns Container

    const container = applyMiddleware(
    createContainer(),
    [A, B],
    );

    The execution order will be:

    1. B before
    2. A before
    3. original function
    4. A after
    5. B after

    This allows outer middlewares to wrap and control the behavior of inner middlewares.