Next.js Discord

Discord Forum

Fetch data with Prisma with pagination and items per page in a RSC

Unanswered
Joel Cipriano posted this in #help-forum
Open in Discord
Hi! I have this page/server component called Dashboard. In it, I'm using Prisma to fetch the initial data. The thing is, the user has to be able to set how many items per page he wants to see and that can only be achieved with some select or radio buttons in a client component. But I can't "track" a handleItemsPerPage event from a client component because in the server I can't use useState. What is the proper pattern to deal with cases like these?

2 Replies

Aaand the answer is: a combination of server-side rendering, client-side state management, and URL-based parameters