← All exam tracks
React · State · Effects · Components
React JS
Practice original scenario-based React JS questions. Take a timed mock, focus on a topic, and learn from detailed explanations. These are independent practice materials, not official exam questions or a guarantee of certification readiness.
16 questions · 24 minutes · 70% practice target
Create an account to practice
Already a member? Sign in
Topics you will practice
- State & Identity
- Effects & Async Work
- State Architecture
- Quality & Performance
Try a sample
Think through each question, then reveal the explanation. Full attempts save your answers and scores to your account.
A click handler calls setCount(count + 1) three times while count is 0. In this handler all calls read the same render snapshot. What is the resulting count after React processes them?
- 1
- 3
- 0
- An automatic TypeError
Show answer and explanation
Correct answer: 1
Each call queues replacement with 1 from the same snapshot. Use functional updates when the next value depends on earlier queued state updates.
A handler must increment state three times based on the preceding queued value. Which approach fits?
- Mutate count directly three times
- Call setCount(count + 1) and immediately read the variable as updated
- Set a DOM attribute and assume state changes
- Call setCount(c => c + 1) three times
Show answer and explanation
Correct answer: Call setCount(c => c + 1) three times
Updater functions receive the pending state in sequence. Direct mutation and DOM changes do not schedule React state correctly; the current render variable remains a snapshot.
A component mutates an object in state and passes the same reference back to its setter. The display may not update. What should change?
- Change only the object variable name
- Move every object into a global singleton
- Create a new object with the changed property and preserve other values
- Force a full browser reload after every mutation
Show answer and explanation
Correct answer: Create a new object with the changed property and preserve other values
React can skip updates when the state identity is unchanged. Creating a new value expresses the update; renaming references or using global mutation does not solve the state model.
Study references