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, useRef, useReducer } from 'react'; | |
export const useFetch = (url) => { | |
const cache = useRef({}); | |
const initialState = { | |
status: 'idle', | |
error: null, | |
data: [], | |
}; |
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
/** | |
Method to remove directory and files recursively & | |
check if user wants to delete the directory or just the files in it. | |
**/ | |
const fs = require('fs'); | |
const path = require('path'); | |
function rmDir(dir, rmSelf = true) { | |
let files; | |
try { | |
files = fs.readdirSync(dir); |