Created
February 16, 2017 11:37
-
-
Save pahund/abcf4a7dd18955356526bd4cf2fe7cee to your computer and use it in GitHub Desktop.
Code exerpts from universal-react-router4 – App.js
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
export default ({ gists }) => ( | |
<div> | |
<Sidebar> | |
{ | |
gists ? gists.map(gist => ( | |
<SidebarItem key={gist.id}> | |
<Link to={`/g/${gist.id}`}> | |
{gist.description || '[no description]'} | |
</Link> | |
</SidebarItem> | |
)) : (<p>Loading…</p>) | |
} | |
</Sidebar> | |
<Main> | |
<Route path="/" exact component={Home} /> | |
{ | |
gists && ( | |
<Route path="/g/:gistId" render={ | |
({ match }) => ( | |
<Gist gist={gists.find(g => g.id === match.params.gistId)} /> | |
) | |
} /> | |
) | |
} | |
</Main> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment