Add comment

This commit is contained in:
MartinBraquet
2025-11-08 18:48:47 +01:00
parent 39a8568663
commit 0a9b08803e

View File

@@ -7,6 +7,7 @@ import { useEvent } from 'web/hooks/use-event'
import { useIsClient } from 'web/hooks/use-is-client'
export const usePersistentLocalState = <T>(initialValue: T, key: string) => {
// Note: use a version (like "-v1") in the key to increment after backwards-incompatible changes
const isClient = useIsClient()
const [state, setState] = useStateCheckEquality<T>(
(isClient && safeJsonParse(safeLocalStorage?.getItem(key))) || initialValue