Here is my code for reference:
const vantaRef = useRef(null);
useEffect(() => {
const vantaEffect = NET({
el: vantaRef.current,
THREE: THREE,
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.0,
minWidth: 200.0,
scale: 1.0,
scaleMobile: 1.0,
color: 0xff3f81,
lineColors: 0xff3f81,
backgroundColor: 0x0,
points: 20.0,
spacing: 17.0,
showDots: true,
maxDistance: 20.0,
});
console.log("Vanta Effect:" , vantaEffect);
return () => {
if (vantaEffect) vantaEffect.destroy();
};
}, []);