Chapter 15 · Example 4 · Data fetching and race conditions

Compare result id via ref

Storing the latest id in a ref lets the then callback ignore any fetch result whose returned id no longer matches the active page.

Loading live editor…