SSR
Server-side rendering with SoulCache
Server-Side Rendering
SoulCache supports server-side rendering for instant page loads.
Usage
Server Component
Client Component
Features
Automatic Serialization
Data is automatically serialized for transport between server and client
Type-Safe Hydration
Full TypeScript support for dehydrated state
Partial Hydration
Only hydrate the queries that are needed
Streaming Support
Works with React's streaming SSR for progressive loading
Best Practices
SSR Guidelines
- Fetch on server — Pre-populate cache for instant page loads
- Hydrate early — Before first render for optimal performance
- Match queries — Server and client must use the same query keys
- Handle mismatches — Gracefully handle differences between server and client