mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-18 13:47:08 -04:00
Add comment
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user