-
Hi, I was trying to use OrbitControl's ref in a typescript library. I am having a hard time finding what is the correct ref type for those components. In the below code, does anyone would possibly know what would be the current type of control? (rather than any) function app() {
const control = useRef<OrbitControlsProps>()
return (
<Canvas>
<ambientLight />
<pointLight position={[10, 10, 10]} />
<OrbitControls
enablePan={true}
enableZoom={true}
enableRotate={true}
ref={control}
/>
</Canvas>
);
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
drei uses three-stdlib, so it's this type: btw you can't rely on refs outside of canvas. they will not be filled in useEffect because canvas is a different react root. |
Beta Was this translation helpful? Give feedback.
-
What about exporting impl from drei directly as suggested in #937 ? |
Beta Was this translation helpful? Give feedback.
drei uses three-stdlib, so it's this type:
import { OrbitControls } from 'three-stdlib'
btw you can't rely on refs outside of canvas. they will not be filled in useEffect because canvas is a different react root.