Function getRouteItem

Finds a route item that matches the given pathname from the provided routes array.

  • Type Parameters

    • T extends ISwitchItem = ISwitchItem

    Parameters

    • routes: T[]

      An array of switch items.

    • pathname: string

      The pathname to match against the route items.

    Returns null | T

    • The matched route item, or null if no match is found.