Skip to main content

useFetchers

Returns an array of all in-flight fetchers. This is useful for components throughout the app that didn’t create the fetchers but want to use their submissions to participate in optimistic UI.
This hook only works in Data and Framework modes.

Signature

Parameters

None.

Returns

Array<Fetcher & { key: string }>
An array of all in-flight fetchers, each with a unique key property and the following fields:

Usage

Global loading indicator

Optimistic UI across components

Track pending deletions

Show pending form submissions

Count active requests

Common Patterns

Optimistic shopping cart

Show all form errors

Disable button during any submission

Track upload progress

Optimistic list updates

Type Safety

Important Notes

Only in-flight fetchers

useFetchers only returns fetchers that are currently active (not idle with no data). Once a fetcher completes and moves to idle state, it will still appear in the array if it has data.

Key uniqueness

Each fetcher has a unique key that you can use to identify it:

Performance

For large numbers of fetchers, consider memoizing filtered results: