React.js click function

{ => (
<div className={offer-applied-action ${abc ? 'applied': ''}} onClick={()=> setAbc(!abc)}>Apply

map function generates two div as per my JSON data and I want to add a click function on it when once clicked all should be deactivated/deselected except the clicked one.

You’re using a div here, but did you mean for it to be a button instead? buttons have a disabled attribute you can toggle.

What do you mean by deactivated/deselected?

If you need to know which element was clicked you can look at the event object inside the event handler.

there are more than two apply buttons as per the requirement but the situation is i can apply only one voucher so if there are already applied offer and i want to select another offer then the already applied offer button should be disabled.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.