useOrientation

React sensor hook that tracks screen orientation of user's device.

hooks
Description of the SVG image Loading...

Variants

with useHooks

Description of the SVG image Loading...

The useOrientation React Hook simplifies the management of a device’s orientation within a React application. It wraps the complexity of listening for, handling, and cleaning up after orientation changes into a reusable hook. By abstracting this logic, the hook allows you to easily track device orientation, resulting in cleaner and more readable code. It adapts to both the Screen Orientation API and the deprecated window.orientation property, providing flexibility across different browser capabilities.

Installation

Run the following command:

npx ever-ui-clx@0.2.1 add demo-use-orientation
# └──> Hook coming soon.

Usage