import { Clone, useGLTF, useTexture } from "@react-three/drei"; import { MyContext } from "./data/contextapi"; import { useContext } from "react"; import * as THREE from "three"; export default function Handle() { const { width, height, handle, frameType } = useContext(MyContext); const grip = useGLTF(`./models/Handle ${handle}.glb`); const texture = useTexture(frameType); grip.scene.traverse((child) => { if (child.isMesh) { child.material = new THREE.MeshBasicMaterial({ map: texture, side: THREE.DoubleSide, }); } }); return ( <> ); }