Browser APIs
useOrientation
About
Hook to detect and track device orientation changes in React applications.
Examples
Arguments
This hook takes no arguments.
Return value
| Return value | Type | Description | 
|---|---|---|
| orientation | ScreenOrientation | null | Current orientation object with angleandtypeproperties, or null if not supported | 
ScreenOrientation Properties
| Property | Type | Description | 
|---|---|---|
| angle | number | The orientation angle in degrees (0, 90, 180, or 270) | 
| type | string | The orientation type (e.g., "portrait-primary", "landscape-primary", "portrait-secondary", etc.) |