Implement a useMediaQuery hook that subscribes to and responds to media query changes (e.g. screen size, resolution, orientation, etc.).
useMediaQuery
export default function Component() { const isSmallDevice = useMediaQuery('only screen and (max-width: 768px)'); return <div>{isSmallDevice && <a href="#">Menu</a>}</div>;}
Hint: The window.matchMedia API is helpful.
window.matchMedia
query: string
The hook returns a boolean value that indicates whether the media query matches.
window.matchMedia(query).matches
change
query
MediaQueryList
resize
console.log()