@designbycosmic/cosmic-react-resize-hook
v0.1.0
Published
React hook for listening to window resize events
Downloads
7
Readme
cosmic-react-resize-hook
React hook for listening to window resize events
How to use
// from any functional component
import { useWindowSize } from "cosmic-react-resize-hook";
const WindowSizeWatcher = () => {
const { innerWidth, innerHeight, outerWidth, outerHeight } = useWindowSize();
return (
<p>The current window size is {`width: ${innerWidth}px, height: ${innerHeight}px`}</p>
);
}
export default WindowSizeWatcher;