I am trying to get value of the attribute 'data-id'. But when i try to get the value of 'data-id' from onchange eventhandler. I am getting a null value.
function handleChange(event, e, id) {
const currentID = e.target.getAttribute('data-id');
}
return(
settings.map(item => {
return (
<div>
<div>
<Switch
checked={item.value}
color="primary"
name="checkedB"
inputProps={{ "aria-label": "primary checkbox" }}
onChange={(event, e) => handleChange(event, e, item.ltbAppSettingID)}
id={"firmSwitch-"+item.settingName}
data-id={item.settingName}
/>
<label class="checkLabel" htmlFor={item.ltbAppSettingID}>
<span>{item.name}</span>
</label>
</div>
}
)