import { useEffect, useState } from "react";
const useLocalStorage = (key, defaultValue) => {
    const [value, setValue] = useState(() => getValueFromStorage(key, defaultValue));
    useEffect(() => localStorage.setItem(key, JSON.stringify(value)), [key, value]);
    return [value, setValue];
};
const getValueFromStorage = (key, defaultValue = "") => { var _a; return _a = JSON.parse(localStorage.getItem(key)), (_a !== null && _a !== void 0 ? _a : defaultValue); };
export default useLocalStorage;
//# sourceMappingURL=index.js.map