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

146
Vistas
Getting "InternalError: too much recursion" when retrieving data from Firebase Realtime DB

I'm putting together a component that is supposed to retrieve all users from the DB, which it does - the problem is that it doesn't stop, and retrieves data from the DB endlessly until the app crashes and unsurprisingly gives the error in the title.

Here is the code in question:

const Dashboard = () => {
      const [usersList, setUsersList] = useState([]);
const userRef = query(ref(db, '/Users'));
onValue(userRef, (snapshot) => {
    let userlist = [];
    snapshot.forEach((snap) => {
        userlist.push(snap.toJSON());
    });
    setUsersList(userlist);
    

}, {
    onlyOnce: true
});
return(
    <div>
    {usersList.map(data => {
        return (
                    <div class="profile_info">
                        {data.name}
                    </div>
        );
    })}
    </div>
)
}

To reiterate, it will provide a list of names as expected, but after a few moments it will crash, providing the "InternalError: too much recursion" error. I've done some troubleshooting on my own prior to posting the question and have narrowed it down to the process of sticking all the data in a temporary array and then setting that array into state being responsible, but everything I've seen online about this process seems to point to that being the proper way to do what I'm trying to do, and so I'm feeling stuck.

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