Use ES6 spread operator instead of .concat for nav items
parent
b2b5426cc3
commit
b88ced9526
|
@ -34,28 +34,21 @@ const SideNav = React.createClass({
|
|||
},
|
||||
|
||||
renderUserMenuBlockWithCustomLinks(customLinks, logoutLink) {
|
||||
return [<NavHeader key={0} title="User" />].concat(
|
||||
customLinks
|
||||
.map(({name, url}, i) =>
|
||||
<NavListItem
|
||||
key={i + 1}
|
||||
useAnchor={true}
|
||||
isExternal={true}
|
||||
link={url}
|
||||
>
|
||||
{name}
|
||||
</NavListItem>
|
||||
)
|
||||
.concat(
|
||||
<NavListItem
|
||||
key={customLinks.length + 1}
|
||||
useAnchor={true}
|
||||
link={logoutLink}
|
||||
>
|
||||
Logout
|
||||
</NavListItem>
|
||||
)
|
||||
)
|
||||
return [
|
||||
<NavHeader key={0} title="User" />,
|
||||
...customLinks.map(({name, url}, i) =>
|
||||
<NavListItem key={i + 1} useAnchor={true} isExternal={true} link={url}>
|
||||
{name}
|
||||
</NavListItem>
|
||||
),
|
||||
<NavListItem
|
||||
key={customLinks.length + 1}
|
||||
useAnchor={true}
|
||||
link={logoutLink}
|
||||
>
|
||||
Logout
|
||||
</NavListItem>,
|
||||
]
|
||||
},
|
||||
|
||||
render() {
|
||||
|
|
Loading…
Reference in New Issue