import { useState } from 'react'; function useStorage(key) { let [value, setValue] = useState(() => localStorage.getItem(key)); function setStorage(newValue) { localStorage.setItem(key, newValue); setValue(newValue); } return [value, setStorage]; } export default useStorage;