We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39a8568 commit 0a9b088Copy full SHA for 0a9b088
web/hooks/use-persistent-local-state.ts
@@ -7,6 +7,7 @@ import { useEvent } from 'web/hooks/use-event'
7
import { useIsClient } from 'web/hooks/use-is-client'
8
9
export const usePersistentLocalState = <T>(initialValue: T, key: string) => {
10
+ // Note: use a version (like "-v1") in the key to increment after backwards-incompatible changes
11
const isClient = useIsClient()
12
const [state, setState] = useStateCheckEquality<T>(
13
(isClient && safeJsonParse(safeLocalStorage?.getItem(key))) || initialValue
0 commit comments