I am trying to render this reactstrap CustomInput in a loop. Everything renders correctly, however, the console.log(index)
always prints out 0. I'm not sure why?
Could someone please explain why this is happening and how I can fix it? I
{managementTabData.map((item, index) => (
<tr>
<td>
<CustomInput
type="switch"
id="exampleCustomSwitch"
name="customSwitch"
checked={item.allowView}
onClick={() => console.log(index)}
/>
</td>
</tr>
))}