use-media-query hook allows to subscribe to media queries.
It receives media query as an argument and returns
true if given media query matches current state.
Hook relies on
and will return
false if api is not available unless initial value is provided in the second argument.
Resize browser window to trigger
During server side rendering hook will always return
window.matchMedia api is not available,
if that is not a desired behavior, you can override initial value: