CodingWithJamal
CodingWithJamal11mo ago

SSR with Next.js and Pagination

i didnt realize until today that convex had helpers for nextjs server side. This might make me rewrite some of my components into rsc and use these and not the normal client hooks. So for this function https://docs.convex.dev/api/modules/nextjs#preloading-data (preloadQuery) can we also do usePaginatedQuery ? Right now im using this on my client side and want to see if i can make this change.
Module: nextjs | Convex Developer Hub
Helpers for integrating Convex into Next.js applications using server rendering.
2 Replies
Michal Srb
Michal Srb11mo ago
I would advise to use preloadQuery when you either need SEO or the initial page load performance is critical. preloadQuery doesn't have direct support for paginated queries, but you can probably make it work by passing in paginationOptions explicitly, and then writing your own usePreloadedPaginatedQuery.
CodingWithJamal
CodingWithJamalOP11mo ago
okay thanks!

Did you find this page helpful?