app.get('/playground', handler);http://localhost:9000/playground
| async function asyncForEach(array, callback) { | |
| for (let index = 0; index < array.length; index += 1) { | |
| // eslint-disable-next-line no-await-in-loop | |
| await callback(array[index], index, array); | |
| } | |
| } | |
| // credit to https://codeburst.io/javascript-async-await-with-foreach-b6ba62bbf404 |
| import { useState } from 'react'; | |
| // credit: https://usehooks.com/useLocalStorage/ | |
| function useLocalStorage(key, initialValue) { | |
| const [storedValue, setStoredValue] = useState(() => { | |
| try { | |
| const item = window.localStorage.getItem(key); | |
| return item ? JSON.parse(item) : initialValue; | |
| } catch (error) { | |
| console.log(error); |