Skip to content

useDeviceMotion ​

Category
Utilities

that work with device motion

typescript
import { useDeviceMotion } from '@siberiacancode/reactuse';

Usage ​

typescript
const { interval, rotationRate, acceleration, accelerationIncludingGravity } = useDeviceMotion();

Demo ​

Api ​

Parameters

NameTypeDefaultNote
delay?number1000The delay in milliseconds
callback?(event: DeviceMotionEvent) => void-The callback function to be invoked
enabled?booleantrueWhether to enable the hook

Contributors ​

Source • Demo