@anurbe's suggestion results in:
Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.
import React, {Suspense, useMemo} from 'react';
import {Canvas, useLoader} from '@react-three/fiber/native';
import {OBJLoader} from 'three/examples/jsm/loaders/OBJLoader';
import * as THREE from 'three'
function App(): JSX.Element {
const buffer = useLoader(THREE.FileLoader, require('./assets/tree.obj'));
const obj = useMemo(() => new OBJLoader().parse(THREE.LoaderUtils.decodeText(buffer)), [buffer])
return (
<Canvas>
<ambientLight/>
<pointLight position={[10,10,10]} />
<Suspense fallback={null}>
<mesh>
<primitive object={obj} scale={10}/>
</mesh>
</Suspense>
</Canvas>
);
}
Hi there, I cannot for the life of me figure out what I am doing wrong here. Please help!
I have followed the advice of the existing issues: https://github.com/pmndrs/react-three-fiber/issues/3085 https://github.com/pmndrs/react-three-fiber/issues/3199
@anurbe's suggestion results in:
Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.
@CodyJasonBennett suggestion results in:
TypeError: Cannot read property 'OBJLoader' of undefined