Next.js Discord

Discord Forum

Need help with mousemove event in nextjs.

Answered
Spanish Mastiff posted this in #help-forum
Open in Discord
Spanish MastiffOP
Here is my code on pastebin: https://pastebin.com/BexLLcFx

When I load the room page, the mousemove does not seem to fire. On mousemove, I am trying to show my controls and when mouse becomes inactive, controls disappear. How do I fix this?
Answered by Spanish Mastiff
I solved it. Thx
View full answer

4 Replies

Spanish MastiffOP
My package.json
{
  "name": "watch",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "both": "concurrently \"yarn run dev\" \"nodemon backend/server.js\""
  },
  "dependencies": {
    "@headlessui/react": "^1.7.15",
    "@sweetalert2/theme-dark": "^5.0.15",
    "autoprefixer": "10.4.14",
    "crypto-js": "^4.1.1",
    "dotenv": "^16.3.1",
    "eslint": "8.43.0",
    "eslint-config-next": "13.4.7",
    "jsonwebtoken": "^9.0.0",
    "lodash.debounce": "^4.0.8",
    "moment": "^2.29.4",
    "mongoose": "^7.3.1",
    "next": "13.4.1",
    "postcss": "8.4.24",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-icons": "^4.10.1",
    "react-player": "^2.12.0",
    "react-toastify": "^9.1.3",
    "react-top-loading-bar": "^2.3.1",
    "socket.io": "^4.7.1",
    "socket.io-client": "^4.7.2",
    "sweetalert2": "^11.7.12",
    "tailwindcss": "3.3.2",
    "uuid": "^9.0.0"
  },
  "devDependencies": {
    "prettier": "^2.8.8",
    "prettier-plugin-tailwindcss": "^0.3.0"
  }
}
Asian black bear
It looks like you need to do regular debugging. First make sure that the code to install your listener is running and has the right element ref. Then see if the event handler is being called.
The empty dependency list on your useEffect is kind of suspicious too
Spanish MastiffOP
I solved it. Thx
Answer