Custom React hook that detects the current viewport orientation.
This hook uses the vevet library to determine the orientation of the viewport (either 'portrait' or 'landscape') and updates the state accordingly whenever the viewport is resized.
vevet
const MyComponent = () => { const orientation = useViewportOrientation(); return ( <div> Current Orientation: {orientation} </div> );};
Custom React hook that detects the current viewport orientation.
This hook uses the
vevet
library to determine the orientation of the viewport (either 'portrait' or 'landscape') and updates the state accordingly whenever the viewport is resized.Example