Here is an example of the object in question:
obj : {
"bairro" : "Centro",
"dAula" : {
"Quarta" : true,
"Segunda" : true
},
"dVencimento" : "10",
"dataCadastro" : "10/10/2017",
"dataInicioContrato" : "27/11/2018",
"mensalidades" : {
"2018" : {
"fev" : true,
"jan" : true,
"mar" : true
}
},
"numero" : "111 apto 201",
}
I get a list of students by this.props.list and include them in a table as follows:
class TabelaMensalidade extends Component {
render() {
return(
<tbody>
{
this.props.lista.map((aluno)=>{
return (
<tr key={aluno.key}>
<td>{aluno.bairro}</td>
<td>{aluno.dVencimento}</td>
<td>{aluno.dataCadastro}</td>
<td>{aluno.dataInicioContrato}</td>
<td>{aluno.dAula.Quarta}</td>
<td mes='jan' data-value={aluno.mensalidades.2018.jan}>{aluno.mensalidades.2018.jan}
</tr>
)
})
}
</tbody>
)
}
}
However, I can not access the data in aluno.mensalidades.2018.jan
, and in dAula.Quarta
I can, follow the error:
Uncaught TypeError: Cannot read property 'jan' of undefined
I have tried to use aluno.mensalidades[2018].jan
and aluno.mensalidades['2018'].jan
and the error remains the same