A React Router hook that tells you the current navigation state — whether the app is idle, loading a page, or submitting a form.
useNavigation is a React Router Hook that gives your Component information about the current navigation state. It tells you whether the app is idle, loading a new page, or submitting a form.
import { useNavigation } from 'react-router-dom';
function CreatePostButton() {
const navigation = useNavigation();
const isSubmitting = navigation.state === 'submitting';
return (
<button disabled={isSubmitting}>
{isSubmitting ? 'Posting...' : 'Create Post'}
</button>
);
}
The three navigation states are:
The most common use is creating loading states. When navigation.state === 'submitting', you disable the submit button and show "Posting..." to prevent double submissions. When navigation.state === 'loading', you can show a progress bar or spinner.
useNavigation works alongside useLoaderData (for displaying fetched data), useActionData (for displaying form responses), and Form (for submitting data). Together they form the complete React Router data flow: Form submits → useNavigation shows loading → action processes → useActionData shows result.
We give you the skills to build, deploy, and own a full product. Professional stack, AI co-pilot, no coding background required.