i have been trying to add a scroll area to my the app i was building but i just keep getting this error:
Uncaught Div is not part of the THREE namespace! Did you forget to extend?
I'm very new to three.js and it is even more compicated because i use React.
Here is the code for the App Component(where the error seems to originate from:
import './App.css';
import Header from "./Header";
import WebFont from "webfontloader";
import { useEffect, useRef } from "react";
import { Canvas } from "@react-three/fiber";
import Intro from "./Intro";
import { Stars } from "@react-three/drei";
import About from "./About";
import state from "./state";
function App() {
useEffect(() => {
WebFont.load({
google: {
families: ["Cookie", "Lora", "Playfair Display", "Inknut Antiqua", "Cormorant", "Share Tech Mono"]
}
});
}, []);
const domContent = useRef();
const scrollArea = useRef();
const onScroll = (e) => (state.top.current = e.target.scrollTop);
useEffect(() => void onScroll({ target: scrollArea.current }), []);
return (
<div className="App">
<Header />
<Canvas camera={{ position: [0, 0, 120], fov: 70 }}>
<Stars radius={300} depth={60} factor={7} fade={true} />
<pointLight color="white" position={[5, 2, 5]} intensity={1.3} />
<Intro domContent={domContent} />
<About domContent={domContent} />
</Canvas>
<div className="scrollArea" ref={scrollArea} onScroll={onScroll}>
<div style={{ position: "sticky", top: 0 }} ref={domContent}></div>
<div style={{ height: `${state.pages * 100}vh` }}></div>
</div>
</div>
);
}
export default App;