I have a data structure as below:
{
oldPics: {
[title: 'dog', url: 'www.dog.com'],
[title: 'cat', url: 'www.cat.com'],
[title: 'bird', url: 'www.bird.com'],
},
newPics: {
[title: 'fox', url: 'www.fox.com'],
[title: 'lion', url: 'www.lion.com'],
},
archivedPics: {
[title: 'eagle', url: 'www.eagle.com'],
[title: 'fish', url: 'www.fish.com'],
[title: 'monkey', url: 'www.monkey.com'],
},
}
I want to display the data like this:
<div>
<div>
<h3>old</h3>
<p>title: dog, url: www.dog.com</p>
<p>title: cat, url: www.cat.com</p>
<p>title: bird, url: www.bird.com</p>
</div>
<div>
<h3>new</h3>
<p>title: fox, url: www.fox.com</p>
<p>title: lion, url: www.lion.com</p>
</div>
<div>
<h3>archived</h3>
<p>title: eagle, url: www.eagle.com</p>
<p>title: fish, url: www.fish.com</p>
<p>title: monkey, url: www.monkey.com</p>
</div>
</div>
I have tried in my component to render it as below but it renders empty <div> elements:
_renderPics(group) {
const content = []
const piccies = Object
.keys(group)
.map(key => content.push(
<div key={key}>title: {group[key].title} url: {group[key].url}</div>
));
return content
}
Any idea?