TypologySienna Chen
ToolsLightweight

React Three Fiber

Three.js written as React components.

Three.js written the React way, so a 3D scene is built from components like the rest of a React app. Use it when the 3D lives inside a real product with buttons, pages and state. It comes with a helper library (drei) full of ready-made cameras, controls and materials.

Breaks when
setState inside useFrame tanks fpsSSR/hydration errors on Next.js
Also called
R3F, fiber, drei, @react-three

Prompts

Card fan in a Next.js page
@react-three/fiber v9, @react-three/drei, React 19, Next.js app router (client component, canvas dynamically imported with ssr:false). A <Canvas> with 7 <RoundedBox> cards in a fan, each using drei’s <MeshTransmissionMaterial> (thickness 0.4, chromaticAberration 0.03, roughness 0.15). The hovered card lifts 0.15 units via useSpring from @react-spring/three — never setState in useFrame. Pointer parallax on the group with maath’s damp inside useFrame. <Environment preset="city" /> and <ContactShadows>. Everything inside Suspense with a null fallback.
Scroll story with ScrollControls
R3F scene inside <ScrollControls pages={4} damping={0.2}>. One glTF model rotates and translates from the scroll offset read with useScroll inside useFrame (lerp position.y from offset). HTML captions via <Scroll html> aligned to pages 1–4. Use <PerformanceMonitor> to drop DPR from 2 to 1 when fps falls under 50. No OrbitControls, no autoRotate.
Data-driven instanced field
In R3F, an <instancedMesh> with 5,000 instances of IcosahedronGeometry(0.06, 0). Positions come from a props array of {x, y, z, value}; per-instance color from value on a mint-to-yolk ramp via setColorAt. Write instanceMatrix only when props change (useEffect), not per frame; in useFrame only the group rotation changes. Add <Stats /> in development and confirm a single draw call in the console.

Related

Resources · 4