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

108
Vistas
Get nested data from Firebase Firestore

Here is how I get the data:

enter image description here

Currently when I console.log(snapshotData.data); I get an array of this:

enter image description here

what I want to get is editorState, blocks, 0, text. I tried to get it using snapshotData.data.editorState.blocks.[0].text, and snapshotData.data.editorState.blocks.0.text and it didn't work

again, I want to get this:

enter image description here

On Firestore it's says: editorState is map, blocks -> array, 0 -> map, text -> string

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try

// if blocks is an Array
snapshotData.data.editorState.blocks[0].text

or

// if '0' is a key corresponding to the smaller object
snapshotData.data.editorState.blocks["0"].text

Update

According to the screenshot uploaded, blocks is actually an array containing one single object.

You should use the first code block I provided, i.e.

snapshotData.data.editorState.blocks[0].text
about 4 years ago · Juan Pablo Isaza Denunciar

0

Fixed by using optional chaining

  console.log(snapshotData?.data?.editorState?.blocks[0]?.text);
about 4 years ago · Juan Pablo Isaza Denunciar
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