Skip to content

Instantly share code, notes, and snippets.

@awinogradov
Created January 18, 2018 10:10
Show Gist options
  • Save awinogradov/601b4d2446d20e3293f3ac8ad355b3cc to your computer and use it in GitHub Desktop.
Save awinogradov/601b4d2446d20e3293f3ac8ad355b3cc to your computer and use it in GitHub Desktop.
export default class Stars extends Component {
async componentDidMount() {
let stars = await githubStars(this.props.repo);
this.setState({ stars });
}
render({ repo }, { stars=0 }) {
let url = `//github.com/${repo}`;
return (
<a href={url} class="stars">
⭐️ {stars} Stars
</a>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment