({
children,
device,
onChange,
...settings
})
| 16 | |
| 17 | // ReactNode and ReactElement typings are a little funky for functional components, so the ReactElement cast is needed on the return |
| 18 | const 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 | |
| 32 | export default MediaQuery |
nothing calls this directly
no test coverage detected
searching dependent graphs…