5032dd926a
This PR does the following: - Update documentation referencing @zeit/fetch to @vercel/fetch - Switch packages @zeit/fetch to @vercel/fetch - ~~Fix `browser.js` to actually use @vercel/fetch, it was only using unfetch directly before~~ - Update React to 17 - Change folder name and package name
21 lines
501 B
JavaScript
21 lines
501 B
JavaScript
import Link from 'next/link'
|
||
import fetch from '../fetch'
|
||
|
||
export default function Index({ stars }) {
|
||
return (
|
||
<div>
|
||
<p>Next.js has {stars} ⭐️</p>
|
||
<Link href="/preact">
|
||
<a>How about preact?</a>
|
||
</Link>
|
||
</div>
|
||
)
|
||
}
|
||
|
||
export async function getStaticProps() {
|
||
const res = await fetch('https://api.github.com/repos/vercel/next.js')
|
||
const json = await res.json() // better use it inside try .. catch
|
||
return {
|
||
props: { stars: json.stargazers_count },
|
||
}
|
||
}
|