This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react"; | |
import { useLocation } from "react-router-dom"; | |
const ScrollToTop = () => { | |
const location = useLocation(); | |
console.log(location); | |
useEffect(() => { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function getRepoStarsAndForks(owner, repo, token) { | |
const endpoint = `https://api.github.com/repos/${owner}/${repo}`; | |
const headers = { | |
Authorization: `Token ${token}`, | |
}; | |
try { | |
const response = await fetch(endpoint, { headers }); | |
const data = await response.json(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Min = 60 * 1000; // milliseconds in Minute | |
const Hour = Min * 60; // milliseconds in Hour | |
const Day = Hour * 24; // milliseconds in day | |
const Week = Day * 7; // milliseconds in week | |
const Month = Day * 30; // milliseconds in Month | |
//.toISOString() | |
export const formatDate = (date) => { | |
const currentDate = new Date(); | |
const previousDate = new Date(date); |