Replies: 1 comment 3 replies
-
these are all locals that get reset when the component re-renders let timerx = 500
let hovering = !1
let snapping = !1
let mouseDown = !1 other than that, all that code is unnessesarey, you have events inbuilt in r3f and mousex/y is part of the state model which you can access inside useframe useFrame(state => {
state.mouse.x / y i also don't understand why you init inside useFrame, useFrame is your access to the render loop, it runs 60 times per second. even if you wanted to register events, that's useEffect, which has a proper unmount phase for cleanup. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello I'm experiencing an issue with my mesh; it seems to be re-rendering (twice) on every single mount or state change.
You can observe the problem in the video below. As I refresh the page a couple of times you can see it re-rendering, thus re-starting the animation very quickly.
I also tried to replicate the issue in this code sandbox but for some reason the issue is not happening on there.
Has anyone ever experienced something similar? I thought it had something to do with the textures I was mapping, but even when I remove them and simply make use of a color it keeps happening.
Beta Was this translation helpful? Give feedback.
All reactions