Use ES6 spread operator instead of .concat for nav items

pull/10616/head
Jared Scheib 2017-06-27 10:52:12 -07:00
parent 3622ed91c5
commit 99c6636152
1 changed files with 15 additions and 22 deletions

View File

@ -34,28 +34,21 @@ const SideNav = React.createClass({
}, },
renderUserMenuBlockWithCustomLinks(customLinks, logoutLink) { renderUserMenuBlockWithCustomLinks(customLinks, logoutLink) {
return [<NavHeader key={0} title="User" />].concat( return [
customLinks <NavHeader key={0} title="User" />,
.map(({name, url}, i) => ...customLinks.map(({name, url}, i) =>
<NavListItem <NavListItem key={i + 1} useAnchor={true} isExternal={true} link={url}>
key={i + 1}
useAnchor={true}
isExternal={true}
link={url}
>
{name} {name}
</NavListItem> </NavListItem>
) ),
.concat(
<NavListItem <NavListItem
key={customLinks.length + 1} key={customLinks.length + 1}
useAnchor={true} useAnchor={true}
link={logoutLink} link={logoutLink}
> >
Logout Logout
</NavListItem> </NavListItem>,
) ]
)
}, },
render() { render() {