Skip to content

Instantly share code, notes, and snippets.

@pahund
Created February 16, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahund/abcf4a7dd18955356526bd4cf2fe7cee to your computer and use it in GitHub Desktop.
Save pahund/abcf4a7dd18955356526bd4cf2fe7cee to your computer and use it in GitHub Desktop.
Code exerpts from universal-react-router4 – App.js
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