Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
({ target }) => {
// Some items, e.g. tappable text, cannot be disabled thru DOM attributes
if (!disabled) {
const tabIndex = getTabIndex(target);
// If the user is clicking on something that is already clickable, do not allow them to click the card.
// E.g. a hero card can be tappable, and image and buttons inside the hero card can also be tappable.
if (typeof tabIndex !== 'number' || tabIndex < 0) {
tapAction && performCardAction(tapAction);
}
}
},
[disabled, performCardAction, tapAction]