MCPcopy Create free account
hub / github.com/dailydotdev/apps / update

Function update

packages/shared/src/hooks/utils/useVisualViewport.ts:29–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27export const useVisualViewport = (enabled = true): VisualViewportResult => {
28 const [viewPort, setViewPort] = useState(getVisualViewport); // <- only calls the function 1 time this way - performance improvement
29 const update = () => setViewPort(getVisualViewport);
30 const target = enabled ? globalThis?.window?.visualViewport : undefined;
31 useEventListener(target, 'resize', update);
32 useEventListener(target, 'scroll', update);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected