MCPcopy Create free account
hub / github.com/bvaughn/react-window / onStorage

Function onStorage

src/hooks/useLocalStorage.ts:30–38  ·  view source on GitHub ↗
(event: StorageEvent)

Source from the content-addressed store, hash-verified

28 // Sync changes from local storage
29 useLayoutEffect(() => {
30 const onStorage = (event: StorageEvent) => {
31 if (
32 key === event.key &&
33 event.newValue &&
34 event.newValue !== JSON.stringify(value)
35 ) {
36 setValue(JSON.parse(event.newValue));
37 }
38 };
39
40 window.addEventListener("storage", onStorage);
41

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected