In the below code When clicked on settings the page is redirected to google.com even the e.stopPropagation is written in setting's onClick handler
<a className="App" href="http://google.com" onClick={() => alert("parent")}>
Home
<div
href={"http://youtube.com"}
onClick={e => {
alert("child");
e.stopPropagation();
}}
>
Settings
</div>
</a>
Why is that? But When I add e.preventDefault() it is not redirecting to google.com ? Why e.stopPropagation not working and e.preventDefault is working.Can anyone explain.
sandbox link - https://codesandbox.io/s/l7wx5yzp6m
Thanks.