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

133
Vistas
React Only Showing One Piece Of Data From Collection On Firestore

I am trying to pull a collection of users from FireStore in react with an async function. The code is only pulling one user when I want all users from the collection.

I am new to react and firestore and not sure what I am doing wrong. I have looked through firestore documentation, yet I have been unable to resolve issue.

Thank you for any help!

function Pull() {

    const [blogs,setBlogs]=useState([])
  
    const fetchBlogs=async()=>{
  
      const response=firestore.collection('user');
  
      const data= await response.get();
  
      data.docs.forEach(item=>{
      setBlogs([blogs,item.data()])
        console.log(data)
  
      })
  
    }
  
    useEffect(() => {
  
      fetchBlogs();
  
    }, [])
  
    return (
  
      <div className="App">
  
        {
            blogs.map((items)=>
            <div className="blog-container">
                <h4>{items.user}</h4>
                
              </div>
            )
        }
            
  
          
  
        
  
      </div>
  
    );
  
  }
  
  
  export default Pull;
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