Skip to content

Instantly share code, notes, and snippets.

Last active Jan 13, 2021
What would you like to do?
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { octokit } from './client';
function RepoDetails() {
const [repo, setRepo] = useState();
const { repo: repoName, owner } = useParams();
useEffect(() => {
.request('GET /repos/{owner}/{repo}', {
repo: repoName,
.then((data) => setRepo(;
}, [repoName, owner]);
if (!repo) {
return <b>loading...</b>;
return (
<div className="repo-container">
<p>Description: {repo.description}</p>
<li><b>Forks:</b> {repo.forks}</li>
<li><b>Subscribers:</b> {repo.subscribers_count}</li>
<li><b>Watchers:</b> {repo.watchers}</li>
<li><b>License:</b> {}</li>
export default RepoDetails;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment