useOrientation
Track the screen orientation type using this hook.
Return Values
the screen orientation type that can be portrait-primary
, portrait-secondary
, landscape-primary
, or landscape-secondary
Example Usage
tsx
import { useOrientation } from 'react-pre-hooks';
export default function Example() {
const type = useOrientation();
return (
<main>
<p>
The orientation is <span>{type}</span>.
</p>
</main>
);
}
import { useOrientation } from 'react-pre-hooks';
export default function Example() {
const type = useOrientation();
return (
<main>
<p>
The orientation is <span>{type}</span>.
</p>
</main>
);
}