# React Three Fiber — card for AI agents

React renderer for Three.js enabling 3D graphics with component patterns.

Category: 3D and graphics · npm package `@react-three/fiber` · latest version 9.8.2 (checked 2026-11-01)
Install: `npm install @react-three/fiber`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## React Three Fiber
- Keep @react-three/fiber on the major that matches React: v8 for React 18, v9 for React 19.
- Animate inside useFrame by mutating refs and multiplying by delta; never call setState every frame or on pointer move.
- Reuse geometries and materials (useMemo or module scope); use instancing for repeated objects; keep draw calls in the hundreds.
- Hide heavy parts with visible={false} instead of mounting and unmounting them.
- For mostly static scenes use  and call invalidate() after changing three.js objects directly.
- Load models with useLoader / Drei's useGLTF (cached by URL); turn GLTF files into components with gltfjsx.
- Docs for lookups: https://r3f.docs.pmnd.rs/llms.txt

## Agent Skills for it
- react-three-fiber from midudev/autoskills: `npx skills add midudev/autoskills --skill react-three-fiber`

## Docs written for agents
- [llms.txt (index of the docs)](https://r3f.docs.pmnd.rs/llms.txt)
- [llms-full.txt (full docs in one file)](https://r3f.docs.pmnd.rs/llms-full.txt)
- [Drei llms.txt](https://drei.docs.pmnd.rs/llms.txt)

## What it is
- React Three Fiber (R3F) lets you build a three.js 3D scene out of React components. Each JSX tag maps to a three.js class (a `<mesh>` becomes a `THREE.Mesh`), so the scene graph, materials and loaders are plain three.js, while state, props, hooks and pointer events work the way React developers already know.
- It is maintained by pmndrs, the open-source collective behind Drei, Zustand and react-spring, and runs on the web and, through `@react-three/fiber/native`, in React Native. The official examples range from product configurators and scroll-driven pages to physics scenes and game prototypes.

## Caveats
- Match the React version: R3F is a React renderer and follows React's major version: v8 pairs with React 18, v9 with React 19.
- You need both React and three.js: The README asks newcomers to know React hooks and the basics of three.js (scene, camera, mesh, geometry, material) before starting.
- Animate by mutation, not setState: Fast changes belong in `useFrame`, mutating a ref and scaling by the frame delta; calling `setState` every frame or on pointer moves routes each update through React and slows the scene.
- Watch draw calls and mounting: The docs suggest no more than 1,000 draw calls as a hard maximum, ideally a few hundred, using instancing for repeated objects, and toggling `visible` instead of mounting and unmounting heavy parts.
- WebGPU is still alpha: WebGPU support and a new frame-loop scheduler come with v10, which the docs list as alpha.

## Numbers (AgentGid data)
- Gid Score: 83.2 (#54 of all tools, 2 of 63 in its category)
- Used in 73 public projects set up for AI coding agents (1.2%)
- Downloads last week: 9,292,494 (as of 2026-11-24), +53.0% over 4 weeks
- GitHub stars: 33,905 (as of 2026-11-24)
- Last push: 2026-10-21

## Often used with
Three.js 97.3%, clsx 80.8%, Tailwind Merge 76.7%, React 97.3%, Lucide React 76.7%, Tailwind CSS 95.9%

## Checked alternatives (same job)
- Pixi.js: https://agentgid.com/tools/pixi-js/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/react-three/
- Homepage: https://github.com/pmndrs/react-three-fiber#readme
- Repository: https://github.com/pmndrs/react-three-fiber
- Source: https://github.com/pmndrs/react-three-fiber#readme
- Source: https://r3f.docs.pmnd.rs/getting-started/introduction
- Source: https://r3f.docs.pmnd.rs/getting-started/examples
- Source: https://r3f.docs.pmnd.rs/advanced/scaling-performance
- Source: https://r3f.docs.pmnd.rs/advanced/pitfalls
- Source: https://github.com/pmndrs/react-three-fiber
- Source: https://github.com/pmndrs/react-three-fiber/releases
- Source: https://github.com/pmndrs/examples

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
