Skip to content

Commit 483cd10

Browse files
HaNdTriXTimer
authored andcommitted
Refactor data-fetch example (vercel#8490)
* Remove eslint exclusion https://www.npmjs.com/package/isomorphic-unfetch * Fix emoji char * Update preact.js
1 parent 64e8c61 commit 483cd10

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

examples/data-fetch/pages/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react'
22
import Link from 'next/link'
3-
import 'isomorphic-unfetch'
3+
import fetch from 'isomorphic-unfetch'
44

55
export default class Index extends React.Component {
66
static async getInitialProps () {
7-
// eslint-disable-next-line no-undef
87
const res = await fetch('https://api.github.com/repos/zeit/next.js')
98
const json = await res.json()
109
return { stars: json.stargazers_count }

examples/data-fetch/pages/preact.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react'
22
import Link from 'next/link'
3-
import 'isomorphic-unfetch'
3+
import fetch from 'isomorphic-unfetch'
44

55
export default class Preact extends React.Component {
66
static async getInitialProps () {
7-
// eslint-disable-next-line no-undef
87
const res = await fetch('https://api.github.com/repos/developit/preact')
98
const json = await res.json()
109
return { stars: json.stargazers_count }
@@ -13,9 +12,9 @@ export default class Preact extends React.Component {
1312
render () {
1413
return (
1514
<div>
16-
<p>Preact has {this.props.stars} ⭝︝</p>
15+
<p>Preact has {this.props.stars} </p>
1716
<Link href='/'>
18-
<a>I bet next has more stars (?)</a>
17+
<a>I bet Next.js has more stars (?)</a>
1918
</Link>
2019
</div>
2120
)

0 commit comments

Comments
 (0)