18a9c7e371
* Update `packages/` * Update examples * Update tests * Update bench * Update top level files * Fix build * trigger
23 lines
484 B
JavaScript
23 lines
484 B
JavaScript
import fetch from 'isomorphic-unfetch'
|
|
import Link from 'next/link'
|
|
|
|
const Index = ({ users }) => (
|
|
<ul>
|
|
{users.map(user => (
|
|
<li key={user.id}>
|
|
<Link href="/user/[id]" as={`/user/${user.id}`}>
|
|
<a>{`User ${user.id}`}</a>
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)
|
|
|
|
Index.getInitialProps = async () => {
|
|
const response = await fetch('http://localhost:3000/api/users')
|
|
const users = await response.json()
|
|
|
|
return { users }
|
|
}
|
|
|
|
export default Index
|