React Three Fiber asset loading - useGLTF, useLoader, Suspense patterns, preloading. Use when loading 3D models, textures, HDR environments, or managing loading states.
Inspect installed Fiber, Drei, Three.js, and React versions first. Examples use Fiber 9 / React 19. Verify actual asset paths, node names, formats, and compression; do not invent a model's structure.
Mount below Canvas. Supply /models/robot.glb in the application. These clones have separate object transforms but intentionally share cached geometry/materials.
import { Suspense } from 'react'
import { Clone, useGLTF } from '@react-three/drei'
function Models() {
const { scene } = useGLTF('/models/robot.glb')
return (
<group dispose={null}>
<Clone object={scene} position={[-1.2, 0, 0]} />
<Clone object={scene} position={[1.2, 0, 0]} />
</group>
)
}
export default function Example() {
return (
<Suspense fallback={null}>
<Models />
</Suspense>
)
}
useGLTF for glTF/GLB; use useLoader with the matching Three.js loader for other formats. Fiber 9 also accepts an externally owned loader instance when configuration isolation is needed.null as a pretend URL or call a hook conditionally.three/addons/loaders/GLTFLoader.js. Check installed exports for renamed loaders; modern Three.js uses HDRLoader where older examples used RGBELoader.ThreeElements['group'], not the removed global JSX type namespace.SkeletonUtils.clone root makes ownership explicit.dispose={null} on the shared subtree). An application cache owner may release them only after all consumers are gone.useGLTF.clear(url) nor useLoader.clear(...) is a complete GPU cleanup operation.useGLTF integrates Draco/Meshopt support, but decoder URLs and loader configuration must match the asset and hosting policy. For KTX2 textures, configure a KTX2Loader with renderer capability detection before loading.useProgress reflects the loading manager's activity, not necessarily one asset's byte-accurate completion. Avoid treating an unavailable Content-Length as a trustworthy denominator.