React hook that synchronizes state with window.localStorage.
window.localStorage
Type of the stored value.
The localStorage key.
Default value used if no value exists in storage or if parsing fails.
A tuple containing:
const [theme, setTheme] = useLocalStorage<'light' | 'dark'>('theme', 'light'); Copy
const [theme, setTheme] = useLocalStorage<'light' | 'dark'>('theme', 'light');
React hook that synchronizes state with
window.localStorage.