Install using bunx shadcn@latest add @remix-utils/use-global-navigation-state.
bunx shadcn@latest add @remix-utils/use-global-navigation-state
This depends on react, and react-router.
react
react-router
This hook allows you to read the value of transition.state, every fetcher.state in the app, and revalidator.state.
transition.state
fetcher.state
revalidator.state
import { useGlobalNavigationState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let states = useGlobalNavigationState(); if (state.includes("loading")) { // The app is loading. } if (state.includes("submitting")) { // The app is submitting. } // The app is idle} Copy
import { useGlobalNavigationState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let states = useGlobalNavigationState(); if (state.includes("loading")) { // The app is loading. } if (state.includes("submitting")) { // The app is submitting. } // The app is idle}
The return value of useGlobalNavigationState can be "idle", "loading" or "submitting"
useGlobalNavigationState
"idle"
"loading"
"submitting"
This is used by the hooks below to determine if the app is loading, submitting or both (pending).
This hook lets you know if the global navigation, if one of any active fetchers is either loading or submitting, or if the revalidator is running.
import { useGlobalPendingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalPendingState(); if (globalState === "idle") return null; return <Spinner />;} Copy
import { useGlobalPendingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalPendingState(); if (globalState === "idle") return null; return <Spinner />;}
The return value of useGlobalPendingState is either "idle" or "pending".
useGlobalPendingState
"pending"
This hook combines the useGlobalSubmittingState and useGlobalLoadingState hooks to determine if the app is pending.
useGlobalSubmittingState
useGlobalLoadingState
The pending state is a combination of the loading and submitting states introduced by this hook.
pending
loading
submitting
This hook lets you know if the global transition or if one of any active fetchers is submitting.
import { useGlobalSubmittingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalSubmittingState(); if (globalState === "idle") return null; return <Spinner />;} Copy
import { useGlobalSubmittingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalSubmittingState(); if (globalState === "idle") return null; return <Spinner />;}
The return value of useGlobalSubmittingState is either "idle" or "submitting".
This hook lets you know if the global transition, if one of any active fetchers is loading, or if the revalidator is running
import { useGlobalLoadingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalLoadingState(); if (globalState === "idle") return null; return <Spinner />;} Copy
import { useGlobalLoadingState } from "remix-utils/use-global-navigation-state";export function GlobalPendingUI() { let globalState = useGlobalLoadingState(); if (globalState === "idle") return null; return <Spinner />;}
The return value of useGlobalLoadingState is either "idle" or "loading".
Sergio XalambrÃ
Install using
bunx shadcn@latest add @remix-utils/use-global-navigation-state.This depends on
react, andreact-router.This hook allows you to read the value of
transition.state, everyfetcher.statein the app, andrevalidator.state.The return value of
useGlobalNavigationStatecan be"idle","loading"or"submitting"This is used by the hooks below to determine if the app is loading, submitting or both (pending).
Install using
bunx shadcn@latest add @remix-utils/use-global-navigation-state.This depends on
react, andreact-router.This hook lets you know if the global navigation, if one of any active fetchers is either loading or submitting, or if the revalidator is running.
The return value of
useGlobalPendingStateis either"idle"or"pending".This hook combines the
useGlobalSubmittingStateanduseGlobalLoadingStatehooks to determine if the app is pending.The
pendingstate is a combination of theloadingandsubmittingstates introduced by this hook.Install using
bunx shadcn@latest add @remix-utils/use-global-navigation-state.This depends on
react, andreact-router.This hook lets you know if the global transition or if one of any active fetchers is submitting.
The return value of
useGlobalSubmittingStateis either"idle"or"submitting".Install using
bunx shadcn@latest add @remix-utils/use-global-navigation-state.This depends on
react, andreact-router.This hook lets you know if the global transition, if one of any active fetchers is loading, or if the revalidator is running
The return value of
useGlobalLoadingStateis either"idle"or"loading".Author
Sergio XalambrÃ