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:- React Server Components provide better streaming primitives
- Simpler mental model - less framework-specific APIs to learn
- Better performance - native streaming is more efficient
- Standard APIs - uses Web platform features instead of custom implementations
Migration Checklist
1
Identify defer() usage
Find all instances of
defer() in your loaders2
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 strategy5
Test thoroughly
Verify data loading behavior and user experience