Shubham Pratik
Shubham Pratik

Reputation: 542

Calling data from firebase as per pagination

I have firebase real-time database with a field of employee having more than 2000 entries having details of all employees. In my react-app while fetching the list of employees , I have to first fetch the whole employee field data to display the entries causing a lot of loading time.

Is there any way so that i could be able to query for only 10 entries of employee for the 1st page and while clicking for next page it again fetches the next 10 entries, Because doing so while reduce the time for loading the screens ...

Upvotes: 1

Views: 2302

Answers (1)

Raj Saraogi
Raj Saraogi

Reputation: 1938

Yes surely firebase seems to give the feature of filtering list.

You can use limitToFirst() and startAt(), to implement pagination and get limited data.

For more information you can go with docs https://firebase.google.com/docs/database/web/lists-of-data#filtering_data

Upvotes: 2

Related Questions