Question · JavaScript and React course · Module 3: State and Events
Stopping propagation - what appears in the console?
A button sits inside <div onClick={() => console.log('panel')}>. The button's handler is (e) => { e.stopPropagation(); console.log('button'); }. What appears in the console after clicking the button?
Answer options
- 'button', then 'panel'
- 'panel', then 'button'
- Only 'panel'
- Only 'button'
You can check the correct answer by solving this task in the CodeWorlds game.