@reacthooks.org/use-orientation-change

1.0.8 • Public • Published

Install

$ npm install @reacthooks.org/use-orientation-change

useOrientationChange

React (State and Effect) Hook to get your device orientation.

Synopsis

In your React component:

import useOrientationChange from "use-orientation-change";

function OrientationChange() {
  const orientation = useOrientationChange()

  // 'portrait' or 'landscape'
  return <code>orientation = { orientation }</code>
}

There is no need to subscribe or unsubscribe to the window 'orientationchange' event since this hook does it for you.

Other Hooks

Please see all of the other reacthooks.org hooks:

Author

$ npx chilts

   ╒════════════════════════════════════════════════════╕
   │                                                    │
   │   Andrew Chilton (Personal)                        │
   │   -------------------------                        │
   │                                                    │
   │          Email : andychilton@gmail.com             │
   │            Web : https://chilts.org                │
   │        Twitter : https://twitter.com/andychilton   │
   │         GitHub : https://github.com/chilts         │
   │         GitLab : https://gitlab.org/chilts         │
   │                                                    │
   │   Apps Attic Ltd (My Company)                      │
   │   ---------------------------                      │
   │                                                    │
   │          Email : chilts@appsattic.com              │
   │            Web : https://appsattic.com             │
   │        Twitter : https://twitter.com/AppsAttic     │
   │         GitLab : https://gitlab.com/appsattic      │
   │                                                    │
   │   Node.js / npm                                    │
   │   -------------                                    │
   │                                                    │
   │        Profile : https://www.npmjs.com/~chilts     │
   │           Card : $ npx chilts                      │
   │                                                    │
   ╘════════════════════════════════════════════════════╛

(Ends)

Package Sidebar

Install

npm i @reacthooks.org/use-orientation-change

Weekly Downloads

0

Version

1.0.8

License

ISC

Unpacked Size

7.72 kB

Total Files

5

Last publish

Collaborators

  • chilts
  • chilts-appsattic