New advertisers: 50% off your first month with code FIRSTMONTHSee slots
enzed avatar

R3f Fundamentals

React Three Fiber scene setup with Canvas, typed JSX, hooks, render-loop control, and resource ownership rules.

skills.sh installs
2.4K
GitHub stars
138
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers scene architecture and render-loop setup: Canvas placement, useFrame and useThree usage, and on-demand rendering with invalidate()
  • Includes a minimal rotating-mesh example, scene and type boundary rules, and renderer pitfalls for Fiber 9 with React 19 and Three.js
  • Enforces that Three.js hooks stay beneath Canvas and that DOM UI stays outside it, with Drei Html as the sanctioned bridge
  • Designed for developers setting up R3F scenes who need version-matched APIs and clear disposal ownership rather than materials or effects

Install

$ npx -y skills add enzed/r3f-skills --skill r3f-fundamentals -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

React Three Fiber fundamentals

Choose the right baseline

  • Inspect the project's manifest and lockfile before selecting APIs. These examples target Fiber 9 / React 19; Fiber 8 pairs with React 18. Do not upgrade a project just to match a recipe.
  • Check installed Three.js and Drei versions too. Use released documentation matching those versions; if unavailable, state the uncertainty instead of inventing props.
  • Keep the existing renderer unless the task calls for changing it. For WebGPU, read renderer selection; Fiber 10 alpha APIs are not Fiber 9 APIs.

Minimal scene

This example owns its Canvas. Its parent must have a nonzero height.

import { useRef } from 'react'
import { Canvas, useFrame, type ThreeElements } from '@react-three/fiber'
import type { Mesh } from 'three'

function RotatingBox(props: ThreeElements['mesh']) {
  const mesh = useRef<Mesh>(null)
  useFrame((_, delta) => {
    if (mesh.current) mesh.current.rotation.y += delta * 0.5
  })
  return (
    <mesh {...props} ref={mesh}>
      <boxGeometry args={[1, 1, 1]} />
      <meshStandardMaterial color="coral" />
    </mesh>
  )
}

Details

Repository
github.com/enzed/r3f-skills
Categories
3D, CAD & Modeling, Frontend & UI Code
First seen
May 16, 2026

More from enzed/r3f-skills

All 11

Similar to R3f Fundamentals

More 3D, CAD & Modeling