Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/munafio/react-github-user-stats
Get Github user's stats using React Hooks.
https://github.com/munafio/react-github-user-stats
github-api github-stats react react-hooks react-js
Last synced: 2 months ago
JSON representation
Get Github user's stats using React Hooks.
- Host: GitHub
- URL: https://github.com/munafio/react-github-user-stats
- Owner: munafio
- Created: 2022-06-20T22:07:02.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T09:33:19.000Z (about 2 years ago)
- Last Synced: 2024-10-29T23:07:46.155Z (3 months ago)
- Topics: github-api, github-stats, react, react-hooks, react-js
- Language: TypeScript
- Homepage: https://munafio.github.io/react-github-user-stats/
- Size: 1.97 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-github-user-stats
>
[![NPM](https://img.shields.io/npm/v/react-github-user-stats.svg)](https://www.npmjs.com/package/react-github-user-stats) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
This simple npm package provides you an easy way to get Github user's stats using React Hooks.
## Demo
[Click here](https://munafio.github.io/react-github-user-stats/)
## Install
```bash
npm install --save react-github-user-stats
```## Usage
```tsx
import * as React from "react";
import useGithubStats from "react-github-user-stats";const Example = () => {
const { error, loading, userData } = useGithubStats("munafio");if (loading) return
Loading data..
;
if (error) returnERROR: {error}
;
if (!userData) returnNot found!
;return (
{JSON.stringify(userData, null, 2)}
);
};
```Do not forget to replace `munafio` with the username you want.
## Sample
The `userData` returned from this hook contains props as the below sample shows:
```json
{
"data": {
"id": 20261627,
"name": "Munaf Aqeel Mahdi",
"username": "munafio",
"avatar_url": "https://avatars.githubusercontent.com/u/20261627?v=4",
"url": "https://github.com/munafio",
"type": "User",
"company": "Full-Stack Web Developer",
"website": "munafio.com",
"location": "Babil ⇄ Iraq",
"email": null,
"bio": null,
"twitter_username": "munafiofficial",
"public_repos": 19,
"public_gists": 1,
"followers": 242,
"following": 5,
"total_stars": 1775,
"total_forks": 462,
"created_at": "2016-07-03T01:06:30Z",
"updated_at": "2022-06-12T12:11:17Z"
}
}
```## License
MIT © [munafio](https://github.com/munafio)