Threejs with ReactJs

hello, I’m starting with threejs in reactjs, and I’m having a problem, every time I update my code threejs react creates a new canvas and instead of changing the existing one. I would like a solution that uses react hooks.

that way it works more if possible I would like a solution using react hooks.

I tried it that way but the problem continues and I tried it with useCallback and it didn’t even render.

i would asuggest you use

this is not a wrapper that will fail out of favour or outdate, it’s a renderer that is forever compatible with threejs no matter which version. it abstracts all that stuff, and gives you real pointer events with bubbling and capture phases. also allows you to orchestrate the render-loop per component basis.