--- title: useLocalStorage description: "`useLocalStorage` is a custom hook for storing, updating, and retrieving values in local storage." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-local-storage - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-uselocalstorage--basic --- # useLocalStorage `useLocalStorage` is a custom hook for storing, updating, and retrieving values in local storage. ```tsx const [value, setValue, resetValue] = useLocalStorage({ key: "value", defaultValue: 1, }) return ( ) ``` ## Usage ```tsx import { useLocalStorage } from "@yamada-ui/react" ``` ```tsx import { useLocalStorage } from "@/components/ui" ``` ```tsx import { useLocalStorage } from "@workspaces/ui" ``` ```tsx const [value, setValue, resetValue] = useLocalStorage({ key: "value", defaultValue: 1, }) ``` ## Uses Components & Hooks - [useWindowEvent](https://yamada-ui.com/docs/hooks/use-window-event.md): `useWindowEvent` is a custom hook that assigns an event listener to `window`.