In my react application I have this button which acts like state switcher this button has an id attribute/prop and this button wraps a font-awesome icon.
<button id={feedId}>
<i className={isStatus === 'Y' ? 'fa fa-unlock' : 'fa fa-lock'} />
{isStatus === 'Y' ? 'Active' : 'Inactive'}
</button>
Now depending upon where you click on the button the event.target would return the entire button with id or just the icon that's <i> tag how do I make sure that entire button gets return as part of event.target instead of just <i>
event.targetfor?event.targetto see if it is the button or not. Only proceed when it is the button. Because of bubbling, the button will receive the event all the time.