Respecting the 16ms Frame Budget
Integrating Three.js inside React works best when imperative animation loops remain outside React reconciliation. Updating React state inside requestAnimationFrame triggers costly VDOM diffs.
Instead, mount a dedicated canvas ref container once, bind mouse damping inside mutable closures, and dispose all geometries, materials, and listeners cleanly on unmount.
Reduced Motion & 2D Canvas Fallbacks
Hardware contexts can be unavailable in headless browsers, restricted sandboxes, or older GPUs. Detecting WebGL support upfront and falling back to a lightweight 2D Canvas projection ensures visual continuity.
Honoring prefers-reduced-motion pauses continuous orbital loops while keeping the geometric composition crisp and readable.
Key Takeaway
Keep React state out of the 60Hz animation loop and always pair WebGL visuals with reduced-motion guards.