Skip to content

Instantly share code, notes, and snippets.

@iamhaiderkhan
Created April 4, 2023 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamhaiderkhan/52f61059402e1ea7fd11c0133b209546 to your computer and use it in GitHub Desktop.
Save iamhaiderkhan/52f61059402e1ea7fd11c0133b209546 to your computer and use it in GitHub Desktop.
import useMedia from 'use-media';
const ResponsiveComponent = () => {
const isWide = useMedia({ minWidth: "1000px" });
return (
<span>
Screen is wide: {isWide ? "It's WideScreen" : "It's NarrowScreen"}
</span>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment