T
TanStack3y ago
fair-rose

Pagination + Filter + Sort

I'm currently making a forum site and I want to be able to query posts with pagination (so something like useInfiniteQuery so they all don't load at once) but also support filtering the title by text as well as sorting by a certain column. I was wondering if this is possible to do in React Query and would I have to make multiple different API endpoints? (Currently using Prisma on the backend)
2 Replies
inland-turquoise
inland-turquoise3y ago
if the filtering / sorting should happen on the server, the server needs to support it. doesn't have to be separate api endpoints - could be one endpoint with query params
absent-sapphire
absent-sapphire3y ago
Can we sort the current data from low to high and high to low or we have do it on backend

Did you find this page helpful?