React · Middle · Question 63 of 75
What does setCount(5) do if count is already 5?
- ✓Correct answer: React may bail out and skip re-rendering children, because
Object.is(5, 5)is true - 2It always re-renders the whole subtree
- 3It throws a warning
Explanation
React compares the new state with Object.is. It may still render the component itself once before bailing out, but children and effects are skipped.