@rehooks/device-orientation
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@rehooks/device-orientation

React hook for the Device Orientation API

Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.

You'll need to install react, react-dom, etc at ^16.7.0-alpha.0

Install

yarn add @rehooks/device-orientation

Usage

import useDeviceOrientation from '@rehooks/device-orientation';

function MyComponent() {
  let value = useDeviceOrientation();
  return (
    <div>
      <p>Absolute: {value.absolute}</p>
      <p>Alpha: {value.alpha}</p>
      <p>Beta: {value.beta}</p>
      <p>Gamma: {value.gamma}</p>
    </div>
  );
}

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i @rehooks/device-orientation

    Weekly Downloads

    196

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.72 kB

    Total Files

    6

    Last publish

    Collaborators

    • hanford
    • jmoxey
    • iamsolankiamit
    • fouad
    • mathdroid
    • thejameskyle