usedevicemotion
v1.0.3
Published
React hook for device motion
Downloads
2
Readme
usedevicemotion
Installation
npm install --save usedevicemotion
Usage
import { useDeviceMotion } from 'usedevicemotion'
function Home() {
const deviceMotion = useDeviceMotion()
let deviceMotionData
if (deviceMotion.acceleration) {
deviceMotionData = (
<ul>
<li>X: {deviceMotion.acceleration.x}</li>
<li>Y: {deviceMotion.acceleration.y}</li>
<li>Z: {deviceMotion.acceleration.z}</li>
</ul>
)
}
return <div>{deviceMotionData}</div>
}
export default Home