Keep a value in localStorage, in sync across components and tabs, safe for server rendering.
This is custom React hooks, you need to follow the Basic Rules when you use it.
The value survives a page reload.
const useLocalStorage = <T>(options: {
key: string
defaultValue: T
}) => [
T,
(value: T | ((current: T) => T)) => void,
() => void,
]