Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created May 21, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diego3g/7be51e3165303600a14385ee1bdddc03 to your computer and use it in GitHub Desktop.
Save diego3g/7be51e3165303600a14385ee1bdddc03 to your computer and use it in GitHub Desktop.
import React, { Component } from "react";
import "isomorphic-fetch";
export default class Home extends Component {
static getInitialProps = async () => {
const response = await fetch(
"https://api.github.com/orgs/rocketseat/repos"
);
return { repositories: await response.json() };
};
render() {
return (
<div>
{this.props.repositories.map(repo => (
<h1 key={repo.id}>{repo.name}</h1>
))}
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment