Paginate data from Firestore

I was wondering about the appropriate way to paginate data from Firestore in React Studio. I have a big collection and what I have done is to limit the number of documents to a dataSlot that I can change with a picker, but the behavior is not exactly as I would like. When the user loads the screen, it shows a default 50 documents which is limited with the query options. If the user changes that 50 to 100 in the picker, it will show 100 documents as expected but I have the impression that it loads again the first 50 docs and so on.

What would be the right way to do it?

I’d check this and would try to achieve it it by using data slots and startAfter.

Note that I havent tested it but I would guess that it would overwrite the Data sheet so that previous rows are not visible.

Thank you for your answer and I am sorry if this is a silly question. I understand the process but how can I save a “document” within a dataSlot so I can use the startAfter method?