mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
9c4eefcdbf
* Add prettier for examples directory * Fix files * Fix linting * Add prettier script in case it has to be ran again
24 lines
587 B
JavaScript
24 lines
587 B
JavaScript
import React from 'react'
|
||
import Link from 'next/link'
|
||
import 'isomorphic-unfetch'
|
||
|
||
export default class Preact extends React.Component {
|
||
static async getInitialProps () {
|
||
// eslint-disable-next-line no-undef
|
||
const res = await fetch('https://api.github.com/repos/developit/preact')
|
||
const json = await res.json()
|
||
return { stars: json.stargazers_count }
|
||
}
|
||
|
||
render () {
|
||
return (
|
||
<div>
|
||
<p>Preact has {this.props.stars} ⭐️</p>
|
||
<Link prefetch href='/'>
|
||
<a>I bet next has more stars (?)</a>
|
||
</Link>
|
||
</div>
|
||
)
|
||
}
|
||
}
|