When I provide a literal style object, media queries are considered.
const ResponsiveOk = styled("div")({
color: "green",
"@media screen and (min-width: 400px)": {
color: "red"
}
});
If I use a theme callback instead, media queries do not work anymore:
const ResponsiveNotOk = styled("div")(({ theme }) => ({
color: "green",
"@media screen and (min-width: 400px)": {
color: "red"
}
}));
Demo: https://codesandbox.io/s/m9v69xvo3x
Resize the output window above/below 400 pixel to see the difference: the top row switches between red and green, the bottom row doesn't.
Am I missing something conceptually here or is this supposed to work?