1
Within that events
you have an array of objects, so in your render you can have something like this:
(assuming that events
is in the state
as this.state.events
)
render() {
const events = this.state.events;
const eventsItems = events ? events.data.map(
event => (<p key={event.id}>{event.description}</p>)
) : [];
return (
<div>
{events}
</div>
);
}
Perfect. Now it worked. I still don’t quite understand this conditional. Is this ES6? How would it look in the old syntax?
– Juca Esmanhoto
@Jucaesmanhoto take a look here: https://answall.com/a/4908/129 (this is previous to ES6)
– Sergio
Great! Thank you very much!
– Juca Esmanhoto