Skip to content

Understanding React's behavior under the hood when an exception occurs #33801

Answered by KeviNKvN-X
GlennMiller1991 asked this question in Q&A
Discussion options

You must be logged in to vote

React retries 4 times because it implements a retry strategy for transient errors. It's not 2 because 4 attempts provide better balance between recovering from temporary errors (race conditions, inconsistent state) and performance. This is an internal detail of the Fiber reconciler, your useState executes 4 times because each retry recreates the component.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by GlennMiller1991
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants