Class constructors cannot be invoked without 'new'

Greetings, I think I suffered a little while using glsl. I tried a lot of things but I couldn’t succeed, thanks for what this error is. Below is an example.
https://whclo9.csb.app/

this is overall not how you use threejs, i see so many things i have so no idea what you’re trying to do. <planeGeometry geo={g} ? that’s not in the threejs docs. what is the planegeometry even for?

the error itself is because you write <Komo> instead of <komo>. Uppercase is for components, “Komo” is a THREE.ShaderMaterial. but again, you’re putting a material, without attach, into a geometry, why? only meshes have materials.

here’s a version without errors but it won’t show anything because the code seems confused R3F Wavey Mesh (forked) - CodeSandbox

1 Like

Obviously, as a beginner, you are trying to use three.js with React.

It’s easier to just use pure three.js for now.

Then take a look at some simple examples from the collection.

For example the BeginnerExample. Otherwise, take examples from the newer years, since three.js is constantly changing.

Good luck. :slightly_smiling_face:

1 Like

i think it’s fine to use both at the same time even in the very beginning but i agree in that i’d probably pick easier examples and projects. if i don’t know how to handle instances in threejs, i wouldn’t try to get it done in three + react.

1 Like

you may be right in that regard, r3f is confusing me a bit. I will listen to what you say.

I had also got a similar error saying “class constructor IcosahedronGeometry cannot be invoked without ‘new’”. I resolved it by using extend(), like:
extend(IcosahedronGeometry);
and then using it as
icosahedronGeometry
in my react component tree.