Counter for github stars repository
Wed, Jan 11, 2023
This is a simple counter for github stars repository. You can use it in your website or blog.
How to use it? Just fetch the api and you will get the number of stars.
1. Create a github token
Please use the environment variable to store the token.
2. Write the GET method
3. Use it in your component
Not is necessary to use the useEffect
hook for fetch information. You can use the getStaticProps
or getServerSideProps
hooks.
In my case, I use this hook because the blog is a static site and the endpoint is not available in the build time.
Right now you only have to look up to see the result, the counter is highlighted with a yellow star.
Please if you think this content has helped you or you like it, please give me your star. 🤩