react-three-fiber

Build declarative 3D scenes in React using Three.js components and hooks.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/ayofemiade/cleva --skill react-three-fiber-ayofemiade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-three-fiber
Source: https://github.com/ayofemiade/cleva/tree/main/.claude/skills/react-three-fiber
Command: npx skills add https://github.com/ayofemiade/cleva --skill react-three-fiber-ayofemiade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Building 3D experiences in React with raw Three.js requires imperative object management that conflicts with React's declarative model, making scenes hard to maintain, reuse, and integrate with state management. ## Core Features & Use Cases - Declarative 3D Components: Create Three.js meshes, lights, cameras, and materials as JSX components with full hook support via useFrame, useThree, and useLoader. - Ecosystem Integration: Works with Drei helpers (OrbitControls, Environment, Text, ScrollControls), GSAP, Framer Motion, Zustand, and post-processing effects. - Code Generation Scripts: Generate component boilerplate and complete scene setups with presets for product viewers, games, and performance-optimized scenes. - Use Case: Build an interactive product configurator where users rotate a GLTF model, change materials via controls, and see contact shadows and HDRI environment lighting. ## Quick Start Ask the AI to create a React Three Fiber scene with a rotating box, orbit controls, and environment lighting in a Next.js app.

Frequently Asked Questions about react-three-fiber

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a 3D scene in React with Three.js?▼

Use React Three Fiber's Canvas component to set up the scene, camera, and renderer, then declare Three.js objects as JSX elements like mesh, boxGeometry, and meshStandardMaterial. Props like position and rotation map directly to Three.js object properties.

How to animate objects in React Three Fiber?▼

Use the useFrame hook to run code on every frame, mutating object refs directly for rotation or position changes. Never call setState inside useFrame since it triggers unnecessary React re-renders each frame.

How do I load GLTF models in React Three Fiber?▼

Use useLoader with GLTFLoader or Drei's useGLTF hook, wrapped in a Suspense boundary for async loading. Models are automatically cached, and you can preload them with useGLTF.preload before components mount.

Does React Three Fiber work with Next.js?▼

Yes, React Three Fiber works with React frameworks including Next.js, Gatsby, and Remix. The scene setup script includes framework options for Next.js and Vite project structures.

Why does my React Three Fiber app re-render every frame?▼

This happens when setState is called inside useFrame or when useThree subscribes to the entire state object. Mutate refs directly in useFrame and use selective subscriptions like useThree((state) => state.size).

How to render thousands of objects in React Three Fiber?▼

Use instancedMesh with setMatrixAt to render many identical objects efficiently in a single draw call. Combine with AdaptiveDpr, frameloop="demand", and LOD via Drei's Detailed component for further optimization.