Imagine having an element structured like this:
<Link to={`/games/${game.id}`}>
<GameInfo/>
<CustomButton/>
</Link>
https://i.sstatic.net/0qqOV.png
Can the button inside the link act independently from the link itself without relying on the z-index
css property? The goal is to maintain the current behavior where hovering over the button triggers both the hover effect for the button and the link below.
Currently, when clicking on the Add to Library
button, the game gets added to the library but it also triggers the Link below, unintentionally opening the game profile page.
The only solution I have thought of so far is something like this:
<div> // <= move link hover effects here
<Link to={`/games/${game.id}`}>
<GameInfo/>
</Link>
<CustomButton/>
</div>
However, this workaround is not ideal because I still want the area around the button to be part of the Link (ensuring hover and functionality in the specified areas).
https://i.sstatic.net/swEVc.jpg
Is there any alternative to using z-index
in this scenario?