A
A
Alexander2021-06-13 12:35:55
React
Alexander, 2021-06-13 12:35:55

How to use breakpoints styled-components inside a React component?

Is there a similar media query entry in styled components like material ui?

const SimpleMediaQuery = () => {
  const matches = useMediaQuery("(min-width:600px)");
  
  if (matches) {
    return (
      <Paper elevation={5}>
        <Box p={5}>SimpleMediaQuery breakpoint has a min width of 600px</Box>
      </Paper>
    );
  }
  return <></>;
};

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question