This skill helps synchronize DOM UI elements outside the Canvas with the render loop using external useFrame in React Three Fiber v10.
npx playbooks add skill verekia/r3f-gamedev --skill ui-useframe
Sync UI elements outside the Canvas with the render loop using R3F v10's external useFrame.
Since React Three Fiber v10, useFrame can be used outside of the Canvas component. This allows updating DOM elements in sync with the 3D scene without using Drei's Html component.
useFrame works outside <Canvas> in R3F v10+{ fps: N } option since DOM manipulation is expensiveconst Ui = () => {
const ref = useRef<HTMLDivElement>(null)
useFrame(() => {
ref.current.innerText = `${position.x.toFixed(2)}, ${position.y.toFixed(2)}`
}, { fps: 10 })
return <div ref={ref} className="fixed top-4 right-4" />
}
// Place outside Canvas
<Canvas>
<Scene />
</Canvas>
<Ui />
---
This skill is part of [verekia](https://x.com/verekia)'s [r3f-gamedev](https://github.com/verekia/r3f-gamedev).
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.