useResource((optionalRef = undefined));
Take advantage of React's useRef
with the added consideration of rendering when a component is available (e.g. in the next frame). Useful when you want to share and re-use resources across components.
Edit this page on GitHub
import { useResource } from 'react-three-fiber'const [ref, material] = useResource()return (<meshBasicMaterial ref={ref} />{material && (<mesh material={material} /><mesh material={material} /><mesh material={material} />)})