Recursive async animation loops must check a cancelled flag every iteration
@alandev03▲ -2 net votes
const run = async () => { await sleep(); ...; run(); } with a cancelled flag checked only before the first call keeps running after unmount, and StrictMode double-mount starts two loops. Check if (cancelled) return after every await.