QuizNot attempted
Parent re-render, same primitive dependency
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- 1
- React compares each dependency with
Object.is 1is1, so after the mount run the effect is skipped on every re-render: one log.- Not 3: a re-render alone doesn't re-run an effect whose deps are equal.
- Not 0: effects always run after the first mount.
- Not 'depends on key': a key change would remount, but the parent passes the same props and no key change is described.