You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then you can see, in the useEffect,I set a five-second delay,then setState.
I used useTransition to use concurrent updates,only once.
but the app component update twice ,you can see the view change twice.
this is the image of performance record, you can see the first upadate is sync ,and the second update is conCurrent, why update twice but I setState once.
Link to code example:
The current behavior
The expected behavior
The text was updated successfully, but these errors were encountered:
Here's an adjusted version where each item actually has a forced rendering delay (your empty loop wasn't very representative because the engine probably optimized it away).
gaearon
changed the title
Bug: When I use conCurrent, the App component update twice, you can see the view change twice,but I only change state once.
Bug: Why does startTransition cause two renders instead of one?
Apr 3, 2022
React version: 18
Steps To Reproduce
Link to code example:
The current behavior
The expected behavior
The text was updated successfully, but these errors were encountered: