Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
How to use firebase limits to paginate data

I'm used to php for backend, but I had to use firebase for this project cause of the realtime database...I am trying to paginate data loading. So far, I'm able to select the last 30 records using limitTolast(30). However, after this I need to select 30 older records after the last 30 I previously selected for when the user scrolls to the top...Please how do I achieve this

I already tried limtToLast(30).startAfter(30). thank you.

UPDATE

I found a solution, using endBefore(lastkey).limitToLast(1).However, its still not the best. The issue with this is, I would want to limitToLast(10) but if I do that, it runs the query 10 times with the same value as lastkey which causes repetition in my app. Please how can I fix this...What I would want is either get the last 10 records before lastkey once or allow me change the lastkey each time the query runs. I hope this makes sense

my code looks like this

this.db.child('messages/'+chatid).endBefore(this.state.messages[this.state.messages.length - 1].key).limitToLast(10).once('child_added', snapshot => this.parse(snapshot))
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda