Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Evento de ventana DeviceMotion usando React

No puedo activar la función DeviceMotion en la aplicación React cuando muevo mi navegador. Estoy usando el evento de movimiento del devicemotion del objeto de la window para lograr la funcionalidad.

Extracto de mi código

 export default function App() { const [x, setX] = useState(""); const [y, setY] = useState(""); const [z, setZ] = useState(""); function handleMotionEvent(event) { console.log("handle motion event", event); var x = event.accelerationIncludingGravity.x; var y = event.accelerationIncludingGravity.y; var z = event.accelerationIncludingGravity.z; setX(x); setY(y); setZ(z); } useEffect(() => { window.addEventListener("devicemotion", handleMotionEvent, true); }, [x, y, z]); return ( <div className="App"> <h1>Device Motion</h1> <div> X - {x} Y - {y} Z - {z} </div> </div> ); }

Creé un ejemplo de trabajo usando CodeSandbox . ¿Alguien podría ayudar?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!