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

153
Vistas
Cannot read properties of null (reading 'type')

I have a problem with the map, I do not understand why it gives me the error cannot read properties of null, the elements that are in the array also do not present any nulls so I am not understanding why this error occurs to me.

state = {
    tableHead: [
        '', 'Lunedi', 'Martedi', 'Mercoledi'
    ],
    tableData: {
        value: [
            [{ name: 'David', event1: { test: 'prova', test1: 'prova2' }}],
            [{ name: 'Lorenz', event1: { test: ['2', 'test'] }, event2: '3', event3: '4' }],
            [{ name: 'Victor', event1: { test: ['2', 'test'] }, event2: '3', event3: '4' }],
            [{ name: 'Franklyn', event1: { test: ['2', 'test'] }, event2: '3', event3: '4' }],
        ],
    },

this is my Component Render: <Table borderStyle={{ borderColor: 'transparent' }}>

                            <Row data={this.state.tableHead} style={styles.head} textStyle={styles.text} />

                            {
                                this.state.tableData.value.map((rowData, index) => {
                                    console.log('test', rowData),
                                        <TableWrapper key={index} style={styles.row}>
                                            {
                                                rowData.map((item, index) => {
                                                    console.log('item', item.name),
                                                        <Text textStyle={styles.text}>{item.name} </Text>
                                                })
                                            }
                                        </TableWrapper>
                                })
                            }

                        </Table>
                 
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

It's simple, just add ? before map. Example :

this.state.tableData?.value?.map [your code]

rowData?.map [your code]
about 4 years ago · Juan Pablo Isaza Denunciar

0

WillMount

state = undefined;

DidMount:

state = <your data>;

Your render function run before state has value

Solution is: You must check data first

this.state.tableData?.value?.map
rowData?.map

Check this: Optional Chaining

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