New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-hook-device-orientation

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hook-device-orientation

React hook for accessing device orientation

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

react-hook-device-orientation :dizzy:

A React hook for detecting device orientation.

Installation

Using npm:

npm install --save react-hook-device-orientation

Using yarn:

yarn add react-hook-device-orientation

Usage

import React from 'react'
import useDeviceOrientation from 'react-hook-device-orientation'

const ComponentWithDeviceOrientation = () => {
  const deviceOrientation = useDeviceOrientation()

  return (
    <ul>
      <li>Alpha:    {orientation.alpha}</li>
      <li>Beta:     {orientation.beta}</li>
      <li>Gamma:    {orientation.gamma}</li>
      <li>Absolute: {orientation.absolute ? 'yes' : 'no'}</li>
    </ul>
  )
}

Caveats

There are slightly different implementations of the web API responsible for accessing device orientation, and therefore the values you get from this hook might not be consistent across different browsers. Read more about this.

Contributions

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

Licence

LGPL-3.0

Keywords

react

FAQs

Package last updated on 21 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts