Created
June 29, 2019 19:24
-
-
Save jsmanifest/65d784293ee4ea332776c112f41c0f3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Cereal = ({ items, ...otherProps }) => { | |
const indexHalf = Math.floor(items.length / 2) | |
const items1 = items.slice(0, indexHalf) | |
const items2 = items.slice(indexHalf) | |
return ( | |
<> | |
<ul> | |
{items1.map(({ to, label }) => ( | |
<li key={to}> | |
<Link to={to}>{label}</Link> | |
</li> | |
))} | |
</ul> | |
<ul> | |
{items2.map(({ to, label }) => ( | |
<li key={to}> | |
<Link to={to}>{label}</Link> | |
</li> | |
))} | |
</ul> | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment