Created
June 29, 2019 19:25
-
-
Save jsmanifest/d724aeccbc9b011ab90c0c0795cc96be 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
import { generateRandomUniqueKey } from 'utils/generating' | |
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={generateRandomUniqueKey()}> | |
<Link to={to}>{label}</Link> | |
</li> | |
))} | |
</ul> | |
<ul> | |
{items2.map(({ to, label }) => ( | |
<li key={generateRandomUniqueKey()}> | |
<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