MCPcopy Index your code
hub / github.com/yocontra/react-responsive / MediaQuery

Function MediaQuery

src/Component.ts:18–30  ·  view source on GitHub ↗
({
  children,
  device,
  onChange,
  ...settings
})

Source from the content-addressed store, hash-verified

16
17// ReactNode and ReactElement typings are a little funky for functional components, so the ReactElement cast is needed on the return
18const MediaQuery: FC<MediaQueryProps> = ({
19 children,
20 device,
21 onChange,
22 ...settings
23}) => {
24 const matches = useMediaQuery(settings, device, onChange)
25
26 if (typeof children === 'function') {
27 return children(matches) as ReactElement
28 }
29 return matches ? (children as ReactElement) : null
30}
31
32export default MediaQuery

Callers

nothing calls this directly

Calls 1

useMediaQueryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…