Awaiting A Reaction

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A React code snippet submitted anonymously to The Daily WTF shows useState arrays being mutated directly with splice and push, with those synchronous array methods incorrectly awaited. Despite being fundamentally wrong — bypassing React's immutable state update pattern — the code somehow works, and attempts to refactor it break the checkbox functionality entirely. The submitter suspects the misuse of async/await is accidentally forcing React into a specific re-render timing that the rest of the page depends on, making it nearly impossible to clean up.

2m read timeFrom thedailywtf.com
Post cover image

Sort: