useReadLocalStorage

Custom hook that reads a value from localStorage, closely related to useLocalStorage().

Usage

import { useReadLocalStorage } from "@tealess/hooks";
export default function Component() {
// Assuming a value was set in localStorage with this key
const darkMode = useReadLocalStorage("darkMode");
return <p>DarkMode is {darkMode ? "enabled" : "disabled"}</p>;
}
PrevioususePrevious