React · Junior · Question 59 of 75
How do you stop a click inside a card from also triggering the card's onClick?
<div onClick={openCard}>
<button onClick={(e) => { e.stopPropagation(); like(); }}>Like</button>
</div>- ✓Correct answer: Call
e.stopPropagation()in the inner handler - 2Return
falsefrom the inner handler - 3React events don't bubble, so nothing is needed
Explanation
React events bubble like DOM events (except onScroll). Returning false doesn't stop anything in React; use stopPropagation or preventDefault explicitly.