Skip to main content

Fetchers

Fetchers enable data loading and mutations without causing navigation. They’re perfect for parallel data loading, auto-saving forms, and complex UI interactions.

Basic Usage

Fetcher States

Fetchers have three possible states:

Loading Data with Fetchers

Use fetcher.load() to load data without navigation:

Submitting with Fetchers

Using fetcher.Form

Using fetcher.submit()

Submit FormData:
Submit JSON data:

Accessing Fetcher Data

Named Fetchers

Share fetcher state across components with a key:

Tracking All Fetchers

Access all in-flight fetchers with useFetchers:

Optimistic UI with Fetchers

Form Data Access

Access form data during submission:

Resetting Fetchers

Reset a fetcher back to idle state:

Multiple Parallel Fetchers

Type Safety

Best Practices

Debounce Search Requests

Handle Errors

Clean Up on Unmount

Fetchers automatically clean up when their component unmounts, but you can manually reset them: