React Router API Reference
    Preparing search index...

    Variable NavLinkConst

    NavLink: ForwardRefExoticComponent<
        NavLinkProps & RefAttributes<HTMLAnchorElement>,
    > = ...

    Wraps <Link> with additional props for styling active and pending states.

    • Automatically applies classes to the link based on its active and pending states, see NavLinkProps.className
      • Note that pending is only available with Framework and Data modes.
    • Automatically applies aria-current="page" to the link when the link is active. See aria-current on MDN.
    • States are additionally available through the className, style, and children render props. See NavLinkRenderProps.
    <NavLink to="/message">Messages</NavLink>

    // Using render props
    <NavLink
    to="/messages"
    className={({ isActive, isPending }) =>
    isPending ? "pending" : isActive ? "active" : ""
    }
    >
    Messages
    </NavLink>

    @public

    n/a

    n/a

    n/a

    [modes: framework] n/a

    n/a

    [modes: framework] n/a

    [modes: framework, data] n/a

    n/a

    n/a

    n/a

    n/a

    n/a

    n/a

    [modes: framework, data] n/a