react-code-dataset / react-use /docs /useOrientation.md
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
# `useOrientation`
React sensor hook that tracks screen orientation of user's device.
Returns state in the following shape
```js
{
angle: 0,
type: 'landscape-primary'
}
```
## Usage
```jsx
import {useOrientation} from 'react-use';
const Demo = () => {
const state = useOrientation();
return (
<pre>
{JSON.stringify(state, null, 2)}
</pre>
);
};
```