# react-use-device-orientation

> A React hook to use device orientation on a website.

Latest version **1.0.9** (published 2023-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-use-device-orientation
pnpm add react-use-device-orientation
yarn add react-use-device-orientation
bun add react-use-device-orientation
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2023-08-30 |
| First published | 2023-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zsolt Kebel |
| Maintainers | zsoltkebel |
| Keywords | React |

## Links

- npm: https://www.npmjs.com/package/react-use-device-orientation
- Repository: https://github.com/zsoltkebel/react-use-device-orientation
- Homepage: https://github.com/zsoltkebel/react-use-device-orientation#readme
- Issues: https://github.com/zsoltkebel/react-use-device-orientation/issues
- npm.io page: https://npm.io/package/react-use-device-orientation

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2023-08-30
- 1.0.8 — 2023-08-30
- 1.0.7 — 2023-08-29
- 1.0.6 — 2023-08-29
- 1.0.5 — 2023-08-29
- 1.0.4 — 2023-08-29
- 1.0.3 — 2023-08-29
- 1.0.2 — 2023-08-29
- 1.0.1 — 2023-08-29
- 1.0.0 — 2023-08-29

## README

# React useDeviceOrientation Hook

## Install

`npm i react-use-device-orientation`

## Usage

1. Import `useDeviceOrientation` hook.
2. Call `requestAccess` which prompts the use to grant permission on iOS.
3. Use the `orientation` data.

```js
import { useDeviceOrientation } from 'react-use-device-orientation'

// ...

const { orientation, requestAccess, revokeAccess, error } = useDeviceOrientation()
```

To obtain absolute orientation pass `"absolute"` to the hook as a parameter.

```js
const { orientation, requestAccess, revokeAccess, error } = useDeviceOrientation('absolute')
```

## More Info

https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent#browser_compatibility

---
_Source: https://npm.io/package/react-use-device-orientation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
