You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
342 B
14 lines
342 B
import { useState } from 'react'
|
|
|
|
import { useEventListener } from './useEventListener'
|
|
|
|
export const useScreenOrientation = () => {
|
|
const [orientation, setOrientation] = useState(window.orientation)
|
|
|
|
useEventListener({
|
|
callback: (e) => setOrientation(window.orientation),
|
|
event: 'orientationchange',
|
|
})
|
|
|
|
return orientation
|
|
}
|
|
|