I want to use fields in my map() function, however I get this TypeError: Cannot read property 'fields' of undefined and I don't understand why. Because when I console.log(this.props.schema.fields) I get data printed out in my console.
Question
Why does is this happening? Is it because inside of the return() there is another scope? Or what..?
export default class ObjectDisplay extends Component {
render() {
console.log(this.props.schema.fields)
//const { parentDocumentId, value, open, schema } = this.props
return (
<table>
<tbody>
{this.props.schema.fields.map((schema, i) =>
<ObjectKeyDisplay
key={i}
schema={schema}
value={(this.props.value || {})[schema.name]}
parentDocumentId={this.props.parentDocumentId}
/>
)}
</tbody>
</table>
)
}
}
I am really thankful for all the help.