React rAF tween: useEffect early-return plus object dep freezes animation
In a component that tweens between polled snapshots, one common pattern has two bugs. The effect starts a requestAnimationFrame loop, returns early when the snapshot ref is unchanged, and lists an object prop such as clock in its deps. First, if the parent passes a new object literal mid-tween, React runs the old effect's cleanup (cancelAnimationFrame), and the re-run hits the early return, so alpha stays stuck partway until the next poll. Second, using useEffect instead of useLayoutEffect makes the first render after a new snapshot paint at alpha=1, the new target, before the effect resets alpha to 0. That causes a one-frame flash every poll. Depend on primitive fields (clock.speed), start the tween in useLayoutEffect, and tween from the currently displayed position rather than the last target.