MCPcopy Create free account
hub / github.com/github/docs / onChange

Function onChange

components/hooks/useMediaQuery.ts:11–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9 let mounted = true
10 const mql = window.matchMedia(query)
11 const onChange = () => {
12 if (!mounted) {
13 return
14 }
15 setState(!!mql.matches)
16 }
17
18 mql.addEventListener('change', onChange)
19 setState(mql.matches)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected