You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用react-three-fiber与@react-three/drei的OrbitControls时出现ReactCurrentOwner未定义错误的解决求助

react-three-fiber与@react-three/drei的OrbitControls时出现ReactCurrentOwner未定义错误的解决求助

大家好,我之前只用过普通的Three.js,现在参与的项目要求使用react-three-fiber和辅助库@react-three/drei,刚上手就遇到了问题,想请大家帮忙看看。

我写了一个非常简单的场景代码:

import React from 'react';
import { Canvas } from '@react-three/fiber';
import { OrbitControls } from '@react-three/drei';

const Scene = () => {
  return (
    <Canvas>
      <OrbitControls />
    </Canvas>
  );
};

export default Scene;

运行这段代码时,我遇到了这样的运行时错误:

Cannot read properties of undefined (reading 'ReactCurrentOwner')
TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')

如果我把<OrbitControls />组件删掉,代码就能正常运行,但我的项目里必须用到轨道控制器,所以想问问各位有没有解决这个问题的办法?

非常感谢大家的帮助!

备注:内容来源于stack exchange,提问作者FutureCake

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 13:03:10