Search code examples
javascriptreactjsthree.jsreact-three-fiber

Property 'mesh' does not exist on type 'JSX.IntrinsicElements'


I follow the documentation of React Three Fiber but get stuck in this issue.

Here is my component enter image description here

And dependencies

enter image description here


Solution

  • Finally, I found out the reason for this issue.

    I'm using the version 8 of @react-three/fiber and Vitejs, so I have to extend manually

    import { extend} from '@react-three/fiber'
    import { Mesh, BoxGeometry, MeshStandardMaterial } from 'three'
    
    extend({ Mesh, BoxGeometry, MeshStandardMaterial })
    

    refer this: https://docs.pmnd.rs/react-three-fiber/api/canvas#tree-shaking