Revalidation & Fetchers in React

From the React Router v7 cheat sheet · Data Loading · verified Jul 2026

Revalidation & Fetchers

Data revalidation and non-navigation data fetching

typescript
import { useFetcher, useFetchers, useRevalidator } from 'react-router'

// Fetcher for non-navigation data loading
function NewsletterSignup() {
  const fetcher = useFetcher()

  return (
    <fetcher.Form method="post" action="/newsletter">
      <input name="email" type="email" />
      <button type="submit">
        {fetcher.state === "submitting" ? "Subscribing..." : "Subscribe"}
      </button>
    </fetcher.Form>
  )
}

// Manual revalidation
function RefreshButton() {
  const revalidator = useRevalidator()

  return (
    <button
      onClick={() => revalidator.revalidate()}
      disabled={revalidator.state === "loading"}
    >
      {revalidator.state === "loading" ? "Refreshing..." : "Refresh"}
    </button>
  )
}
💡 Fetchers are perfect for non-navigation data operations
⚡ Use fetcher.Form for forms that don't navigate
📌 shouldRevalidate gives fine control over data refresh
🟢 Fetchers with keys persist across route changes
fetcherrevalidationdata

More React tasks

Back to the full React Router v7 cheat sheet