Custom React hook that provides the current size of the viewport.
This hook uses the vevet library to retrieve the current width and height of the viewport and updates the state whenever the viewport is resized.
vevet
const MyComponent = () => { const { width, height } = useViewportSize(); return ( <div> Viewport Size: {width} x {height} </div> );};
Custom React hook that provides the current size of the viewport.
This hook uses the
vevet
library to retrieve the current width and height of the viewport and updates the state whenever the viewport is resized.Example