-
-
Save yanns1/e5d2c4b353e670af61bfffca2bcdc2a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'm borrowing the MDN doc notation here: "mql" stands for "media query list". | |
const mql = window.matchMedia('(max-width: 600px)'); | |
let mobileView = mql.matches; | |
if (mobileView) { | |
setNavInnerHTML(Component1); | |
} else { | |
setNavInnerHTML(Component2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment