TanStackT
TanStack2y ago
1 reply
awake-maroon

Streaming with Remix

Is it possible to stream in a query using a remix loader? https://tanstack.com/query/latest/docs/framework/react/guides/ssr#full-remix-example

The examples on this page all await the api to fully finish before rendering the page which isn't the user experience that I want. I want to stream in the response instantly but kick off the api on the server for better performance. Is there a way to achieve this?

I've seen the Next JS app router has an experimental package for streaming https://tanstack.com/query/latest/docs/framework/react/examples/nextjs-suspense-streaming, is there anything similar for remix?
An example showing how to implement Nextjs Suspense Streaming, in React Query
In this guide you'll learn how to use React Query with server rendering.

See the guide on Prefetching & Router Integration for some background. You might also want to check out the Performance & Request Waterfalls guide before that.
Was this page helpful?