pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

[v9] feat(useLoader): support loader instances #3131

Closed CodyJasonBennett closed 7 months ago

CodyJasonBennett commented 11 months ago

Supports re-use of external loader instances:

import { GLTFLoader } from 'three-stdlib'
import { useLoader } from '@react-three/fiber'

const loader = new GLTFLoader()

function Model() {
  const gltf = useLoader(loader, '/path/to/model.gltf')
}
codesandbox-ci[bot] commented 11 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6d53ff2458bb50bf8de21e337454b4bb68dea87a:

Sandbox Source
example Configuration