I'm working on a project using React and Three.js.I'm encountering an issue where dragging an object for the first time creates a duplicate of that object. I'd like to understand why this happens and how to prevent it.
Issue
When I drag an object for the first time, it creates a duplicate of that object. Subsequent drags work as expected without creating duplicates.
Code
I've provided the code in the following CodeSandbox link: 3D Model with Three.js
What I've Tried
Ensured that there is no explicit code to duplicate the object.
Checked event listeners to make sure there are no additional listeners being triggered.
Searched for any similar issues online but haven't found a solution.
Expected Behavior
When an object is dragged, it should move without creating any duplicates.
Actual Behavior
The first time an object is dragged, a duplicate is created. Subsequent drags do not create duplicates.
If anyone has experienced a similar issue or has any suggestions on how to resolve this, your help would be greatly appreciated. Thank you!