Skip to content

Instantly share code, notes, and snippets.

@thebetterjort
Created August 10, 2016 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebetterjort/aaf0eeba71dd1649c4d137a3a54492dc to your computer and use it in GitHub Desktop.
Save thebetterjort/aaf0eeba71dd1649c4d137a3a54492dc to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
class Navigation extends Component {
getLinks = (navigation) => {
navigation.map(obj => {
console.log(obj)
let listElements = obj.text.map((li, c) => {
return (
<li key={c}>{li.name}</li>
);
});
return (
<div>
{listElements}
</div>
);
});
}
render() {
let { items } = this.props;
return (
<div>
<ul>
{this.getLinks(items)}
</ul>
</div>
);
}
}
export default Navigation;
@thebetterjort
Copy link
Author

const navigation = [
{
title: 'Title 1',
text: [
{
name: 'item 1',
},
{
name: 'item 2',
}
],
},
{
title: 'Title 2',
text: [
{
name: 'item 1',
},
{
name: 'item 2',
}
],
}
];

@pizzarob
Copy link

You need to return navigation.map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment