# react-hook-screen-orientation

> React hook for accessing screen orientation

Latest version **1.0.4** (published 2022-04-20) · LGPL license · 0 weekly downloads

## Install

```sh
npm install react-hook-screen-orientation
pnpm add react-hook-screen-orientation
yarn add react-hook-screen-orientation
bun add react-hook-screen-orientation
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-04-20 |
| First published | 2019-02-19 |
| Weekly downloads | 0 |
| License | LGPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bence A. Toth |
| Maintainers | bence.a.toth |
| Keywords | react, hook, screenorientation |

## Links

- npm: https://www.npmjs.com/package/react-hook-screen-orientation
- Repository: https://github.com/bence-toth/react-hook-screen-orientation
- Homepage: https://github.com/bence-toth/react-hook-screen-orientation#readme
- Issues: https://github.com/bence-toth/react-hook-screen-orientation/issues
- npm.io page: https://npm.io/package/react-hook-screen-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.4 (latest) — 2022-04-20
- 1.0.3 — 2021-11-21
- 1.0.2 — 2021-10-22
- 1.0.1 — 2019-02-19
- 1.0.0 — 2019-02-19

## README

# react-hook-screen-orientation :arrows_clockwise:

A React hook for detecting [screen orientation](https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation).

## Installation

Using `npm`:

```sh
npm install --save react-hook-screen-orientation
```

Using `yarn`:

```sh
yarn add react-hook-screen-orientation
```

## Usage

```jsx
import React from 'react'
import useScreenOrientation from 'react-hook-screen-orientation'

const ComponentWithScreenOrientation = () => {
  const screenOrientation = useScreenOrientation()

  return (
    <p>Screen orientation is: {screenOrientation}</p>
  )
}
```

## Notes

The `screenOrientation` value provided by the hook is the `type` propery of a [`ScreenOrientation` interface](https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/type) is always one of the following strings:
- `portrait-primary`
- `portrait-secondary` (meaning upside down)
- `landscape-primary`
- `landscape-secondary` (meaning upside down)

## Contributions

Contributions are welcome. File bug reports, create pull requests, feel free to reach out at tothab@gmail.com.

## Licence

LGPL-3.0

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