Working with Three.js and React Three Fiber in templates.
Forge has no 3D dependencies, making it the lightest template.
All 3D components are dynamically imported with SSR disabled to prevent hydration issues and keep initial page load fast:
import dynamic from "next/dynamic";
const Globe = dynamic(
() => import("@/components/landing/globe"),
{ ssr: false }
);Templates with 3D use these packages:
three ^0.182.0@react-three/fiber ^9.5.0@react-three/drei ^10.7.7You can safely remove any 3D component by deleting its import and JSX from the page. Then uninstall the Three.js packages to reduce bundle size:
npm uninstall three @react-three/fiber @react-three/dreiThe rest of the template will continue to work without changes.
Random values (like particle positions) can differ between server and client. Templates use a mounted state pattern to avoid mismatches:
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
// Render neutral state during SSR
// Animate only after mount