Commit 12a877d8 authored by Ilham Wahabi's avatar Ilham Wahabi Committed by Tim Neutkens

fix getting data in class based example (#9938)

Check me if i'm wrong but don't we also need to `import fetch from 'isomorphic-unfetch'` in class based example?
Currently it's just in function based component.

Also I think we should access `stars` from props at first right?
parent b66c34ea
...@@ -37,6 +37,7 @@ Or using a class component: ...@@ -37,6 +37,7 @@ Or using a class component:
```jsx ```jsx
import React from 'react' import React from 'react'
import fetch from 'isomorphic-unfetch'
class Page extends React.Component { class Page extends React.Component {
static async getInitialProps(ctx) { static async getInitialProps(ctx) {
...@@ -46,7 +47,7 @@ class Page extends React.Component { ...@@ -46,7 +47,7 @@ class Page extends React.Component {
} }
render() { render() {
return <div>Next stars: {stars}</div> return <div>Next stars: {this.props.stars}</div>
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment