admin管理员组

文章数量:1124682

I'm creating a viewport, but I keep getting:

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

Currently using react 18

'use client'

import { useState, useEffect, useCallback } from 'react'
import { Canvas, Euler, Vector3 } from '@react-three/fiber'
import { OrbitControls, Grid, Environment, PerspectiveCamera, OrthographicCamera } from '@react-three/drei'

It doesn't work, so I tried

const DynamicCanvas = dynamic(() => import('@react-three/fiber').then(mod => mod.Canvas), { ssr: false });

const OrbitControls = dynamic(() => import('@react-three/drei').then(mod => mod.OrbitControls), { ssr: false });
const Grid = dynamic(() => import('@react-three/drei').then(mod => mod.Grid), { ssr: false });
const Environment = dynamic(() => import('@react-three/drei').then(mod => mod.Environment), { ssr: false });
const PerspectiveCamera = dynamic(() => import('@react-three/drei').then(mod => mod.PerspectiveCamera), { ssr: false });
const OrthographicCamera = dynamic(() => import('@react-three/drei').then(mod => mod.OrthographicCamera), { ssr: false });

It's still giving me the same error. I even updated to the latest version of react and nextjs, and it still doesn't work.

本文标签: