React routing

Date: 2024-01-08

https://reactrouter.com/en/main/hooks/use-href

https://reactrouter.com/en/main/hooks/use-resolved-path#splat-paths

// Use <a href=/> with buttons:
function MyHrefNavigateButton(props: {to: string}) {
    const href = useHref(props.to); // "/my/route"
    return <Button href={href}>Navigate (with open in new tab)!</Button>;
}

// Use <a href=/> in menu items:
export const getMenuItems = (): ItemType[] => [
    {
        key: MenuItemKeys.dashboard,
        icon: <AreaChartOutlined />,
        label: <Link to={AppRoutesFn.dashboard()}> {translate("general.dashboard")} </Link>,
    }];
82100cookie-checkReact routing