diff --git a/src/routes/solid-router/reference/primitives/use-is-routing.mdx b/src/routes/solid-router/reference/primitives/use-is-routing.mdx index e92ea7e2d..37c4e08c6 100644 --- a/src/routes/solid-router/reference/primitives/use-is-routing.mdx +++ b/src/routes/solid-router/reference/primitives/use-is-routing.mdx @@ -9,21 +9,56 @@ tags: - pending - state - ui -version: '1.0' +version: "1.0" description: >- Track route transitions with useIsRouting - display loading states, pending UI, and transition feedback during navigation in SolidJS. --- -Retrieves a signal that indicates whether the route is currently in a transition. -This is useful for showing a stale or pending state when the route resolution is suspended state during concurrent rendering. +The `useIsRouting` function is a utility for detecting when the router is processing a route transition. -```js -const isRouting = useIsRouting(); +## Import -return ( -
- -
-); +```ts +import { useIsRouting } from "@solidjs/router"; ``` + +## Type + +```ts +const useIsRouting: () => () => boolean; +``` + +## Parameters + +None. + +## Return value + +**Type:** `() => boolean` + +An accessor function that returns `true` during route transitions and `false` otherwise. + +## Examples + +### Route transition indicator + +```tsx +import { useIsRouting } from "@solidjs/router"; + +function App() { + const isRouting = useIsRouting(); + + return ( + <> + {isRouting() &&
} + + + ); +} +``` + +## Related + +- [``](/solid-router/reference/components/router) +- [`useNavigate`](/solid-router/reference/primitives/use-navigate)