DEV Community

loading...

Discussion on: Two media queries you should care about

Collapse
httpjunkie profile image
Eric Bishard

I'm assuming something like this would work in React using the react-media-hook library:

const themeToUse = useMediaPredicate("(prefers-color-scheme: dark)") ? "dark" : "light";