react-three-fiber

Rendering only when needed

By default it renders like a game loop 60fps. Switch on invalidateFrameloop to activate loop invalidation. Now it will render on demand when it detects prop changes.

<Canvas invalidateFrameloop ... />

Sometimes you want to render single frames manually, for instance when you're dealing with async stuff or camera controls:

const { invalidate } = useThree();
const texture = useMemo(() => loader.load(url, invalidate), [url]);
Edit this page on GitHub