React Router API Reference
    Preparing search index...

    Type Alias NavLinkRenderProps

    The object passed to NavLink children, className, and style prop callbacks to render and style the link based on its state.

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

    // style
    <NavLink
    to="/messages"
    style={({ isActive, isPending }) => {
    return {
    fontWeight: isActive ? "bold" : "",
    color: isPending ? "red" : "black",
    }
    )}
    />

    // children
    <NavLink to="/tasks">
    {({ isActive, isPending }) => (
    <span className={isActive ? "active" : ""}>Tasks</span>
    )}
    </NavLink>
    type NavLinkRenderProps = {
        isActive: boolean;
        isPending: boolean;
        isTransitioning: boolean;
    }
    Index

    Properties

    isActive: boolean

    Indicates if the link's URL matches the current Location.

    isPending: boolean

    Indicates if the pending Location matches the link's URL. Only available in Framework/Data modes.

    isTransitioning: boolean

    Indicates if a view transition to the link's URL is in progress. See useViewTransitionState