1. @threlte/core
  2. useLoader

@threlte/core

useLoader

useLoader memoizes Loaders to reuse them at any time. Pass in the Loaders class and a function to instantiate the loader.

Import

Source

Github View Source Code

Package

NPM View Package

Example

import { useLoader } from '@threlte/core'
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'

const loader = useLoader(OBJLoader, () => new OBJLoader())
loader.load('models/model.obj', (obj) => {
	console.log(object)
})