Use ES6 spread operator instead of .concat for nav items

pull/1660/head
Jared Scheib 2017-06-27 10:52:12 -07:00
parent b2b5426cc3
commit b88ced9526
1 changed files with 15 additions and 22 deletions

View File

@ -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() {