- Install
nprogress:
npm i nprogress- Put the below code in the
src/routes/__layout.svelte(or something else).
| import { LinkProps, useMatch, useResolvedPath } from 'react-router-dom' | |
| export function useIsActivePath(path: LinkProps['to'], strict = true) { | |
| const resolvedPath = useResolvedPath(path) | |
| const match = useMatch({ path: resolvedPath.pathname, end: strict }) | |
| return match !== null | |
| } |