react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

【Docs】Add first log to useEffect synchronous flow description

Open k35o opened this issue 8 months ago • 2 comments

Overview

This PR corrects the log sequence in the example under Synchronizing with Effects - Putting It All Together.

The current description states:

Now edit the input to say abc. If you do it fast enough, you'll see Schedule "ab" log immediately followed by Cancel "ab" log and Schedule "abc" log.

However, in practice, Cancel "a" log appears before Schedule "ab" log.

⬇︎example in motion https://github.com/user-attachments/assets/e09c5c1a-0777-4e28-b1a9-609f32983f74

Updated the description to accurately reflect the log order:

Now edit the input to say abc. If you do it fast enough, you'll see Cancel "a" log immediately followed by Schedule "ab" log, Cancel "ab" log and Schedule "abc" log.

This ensures the explanation aligns with the actual behavior of the effect cleanup process.

Relevant section.

https://react.dev/learn/synchronizing-with-effects#putting-it-all-together

k35o avatar Mar 10 '25 07:03 k35o