Listening to MediaQueries Events with MatchMedia 📎
matchMedia
you can listen to MediaQueries change events caused by device's breakpoints:
const media = matchMedia('(min-width: 600px)');
media.addEventListener("change", ({ media,matches}) => console.log(media,matches));
...in action: