Skip to main content
The defer() utility has been removed in React Router v7. Use streaming responses with the native Web Streams API or React Server Components instead.

Migration from v6

In React Router v6, defer() allowed you to stream parts of your loader data:

v7 Alternatives

React Router v7 recommends different approaches for streaming data:

1. Using React Server Components (RSC)

With RSC, you can stream components naturally:

2. Using Client-Side Data Fetching

Load critical data in the loader, fetch additional data on the client:

3. Using Multiple Loaders

Split data loading across parent/child routes:

4. Using Web Streams API

For advanced streaming, use native Web Streams:

Why was defer() removed?

React Router v7 focuses on modern patterns:
  1. React Server Components provide better streaming primitives
  2. Simpler mental model - less framework-specific APIs to learn
  3. Better performance - native streaming is more efficient
  4. Standard APIs - uses Web platform features instead of custom implementations

Migration Checklist

1

Identify defer() usage

Find all instances of defer() in your loaders
2

Analyze data requirements

Determine which data is critical vs. can be loaded later
3

Choose migration strategy

Pick the best alternative based on your use case:
  • RSC for server-side streaming
  • Client fetching for progressive enhancement
  • Multiple loaders for route-based splitting
  • Web Streams for advanced streaming
4

Update components

Remove <Await> components and replace with chosen strategy
5

Test thoroughly

Verify data loading behavior and user experience

See Also