I am using MUI in the project and need to check the current breakpoint to render div for mobile, but each time for the first render isMobile and isDesktop value return false but then it set the correct value after second render. It works well from UI side, but I would like to avoid the first unnecessary render if it's possible?
const curTheme = useTheme();
const isMobile = useMediaQuery(curTheme.breakpoints.down("sm"));
const isDesktop = useMediaQuery(curTheme.breakpoints.up("md"));