MCPcopy
hub / github.com/pmndrs/react-three-fiber / useFrame

Function useFrame

packages/fiber/src/core/hooks.tsx:46–54  ·  view source on GitHub ↗
(callback: RenderCallback, renderPriority: number = 0)

Source from the content-addressed store, hash-verified

44 * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
45 */
46export function useFrame(callback: RenderCallback, renderPriority: number = 0): null {
47 const store = useStore()
48 const subscribe = store.getState().internal.subscribe
49 // Memoize ref
50 const ref = useMutableCallback(callback)
51 // Subscribe on mount, unsubscribe on unmount
52 useIsomorphicLayoutEffect(() => subscribe(ref, renderPriority, store), [renderPriority, subscribe, store])
53 return null
54}
55
56/**
57 * Returns a node graph of an object with named nodes & materials.

Callers 15

Box1Function · 0.90
Box2Function · 0.90
TorusKnotFunction · 0.90
BoxFunction · 0.90
SceneFunction · 0.90
SceneAFunction · 0.90
SceneBFunction · 0.90
SodaFunction · 0.90
DuckFunction · 0.90
CandyFunction · 0.90
FlashFunction · 0.90
AppleFunction · 0.90

Calls 2

useMutableCallbackFunction · 0.90
useStoreFunction · 0.85

Tested by 4

MeshFunction · 0.72
ComponentFunction · 0.72
ComponentFunction · 0.72
TestFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…