I created this project while completing Tyler McGinnis' "React Hooks" course.
"GitHub Battle" is a React application that pulls repository and user data from the GitHub API and displays popular repositories categorized by language (JavaScript, Ruby, Java, CSS, Python). The Battle component allows users to input two GitHub usernames and "battle" to see who has a better score/profile. These functions take in the data and calculate each GitHub user's score:
function getStarCount(repos) { return repos.reduce( (count, { stargazers_count }) => count + stargazers_count, 0 ); }
function calculateScore(followers, repos) { return followers \* 3 + getStarCount(repos); }
This project refactors the "GitHub Battle" app I created while completing Tyler McGinnis' "React" fundamentals course, which employed class component architecture. I was able to implement custom hooks and React's built-in Hook API's (including useState, useEffect, useContext, useReducer, useCallback, useMemo, and useRef).
Fetch popular repos:
Battle:
Check out the app here.