Created
August 25, 2016 05:07
-
-
Save rafaelrinaldi/05ad1dbb622df83414b93e8b135c866f to your computer and use it in GitHub Desktop.
This file contains 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
SyntaxError: /Users/tesla/work/pizza/components/main.js: Unexpected token (24:4) | |
22 | {data.map(({group, links}, i) => ( | |
23 | <LinkGroup key={i}>{group}</LinkGroup> | |
> 24 | {links.map((link, i) => ( | |
| ^ | |
25 | <Link key={i} {...link} /> | |
26 | ))} | |
27 | ))} |
This file contains 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 React from 'react'; | |
const data = [ | |
{ | |
group: 'News', | |
links: [ | |
{href: 'http://usatoday.com', children: 'USA Today'}, | |
{href: 'http://nytimes.com', children: 'NYT'}, | |
], | |
}, | |
{ | |
group: 'Coding', | |
links: [ | |
{href: 'http://github.com', children: 'GitHub'}, | |
{href: 'http://news.ycombinator.com', children: 'Hacker News'}, | |
], | |
}, | |
]; | |
const Links = () => ( | |
<div className="links"> | |
{data.map(({group, links}, i) => ( | |
<LinkGroup key={i}>{group}</LinkGroup> | |
{links.map((link, i) => ( | |
<Link key={i} {...link} /> | |
))} | |
))} | |
</div> | |
); | |
const LinkGroup = ({children}) => ( | |
<h3 className="link-group">{children}</h3> | |
); | |
const Link = ({href, children}) => ( | |
<a href={href}>{children}</a> | |
); | |
const Main = () => ( | |
<Links /> | |
); | |
export default Main; |
hugooliveirad
commented
Aug 25, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment