react-use/docs/useOrientation.md
2018-10-27 10:38:23 +02:00

30 lines
381 B
Markdown

# `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>
);
};
```