useMotion

React 传感器钩子,使用设备的加速度传感器跟踪其运动。

用法

  1. import {useMotion} from 'react-use';
  2. const Demo = () => {
  3. const state = useMotion();
  4. return (
  5. <pre>
  6. {JSON.stringify(state, null, 2)}
  7. </pre>
  8. );
  9. };