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} {name}
useAnchor={true} </NavListItem>
isExternal={true} ),
link={url} <NavListItem
> key={customLinks.length + 1}
{name} useAnchor={true}
</NavListItem> link={logoutLink}
) >
.concat( Logout
<NavListItem </NavListItem>,
key={customLinks.length + 1} ]
useAnchor={true}
link={logoutLink}
>
Logout
</NavListItem>
)
)
}, },
render() { render() {