我一直在尝试使用我从中导入的 useRender
import { Canvas, useRender } from 'react-three-fiber';
const App = () => {
const meshRef = useRef();
const [hovered, setHovered] = useState(false);
const [active, setActive] = useState(false);
const props = useSpring({
scale: active ? [4, 4, 4] : [2, 2, 2],
color: hovered ? "red" : "hotpink"
});
useRender(() => {
meshRef.current.rotation.y += 0.01
})
它一直给我一个错误,但是'useRender不是从'react-three-fiber'导出的。当我访问文档(https://inspiring-wiles-b4ffe0.netlify.app/4-hooks)时,它说它可以导出。
有人知道发生了什么吗?我正在关注本教程https://www.youtube.com/watch?v=1rP3nNY2hTo