The arrow function toggle take 2 parameters: element and index, you're passing just index as the first parameter (that should have been element, instead), so index is undefined.
Just change your code as follow:
onClick={index => toggle(element, index)}
UPDATE
The code suggested is wrong as for a copy paste.
The event handler took a parameter that is the event object, you named that parameter index, so when you pass to toggle, it use the event instead of the map index.
Anyway, toggle needs 2 parameters, so you have to pass 2.
I think the proper solution will be:
onClick={ev => toggle(ev.target, index)}
That is fine for the toggle function, but your code still has a bug, so have a look at the @adel answer.
toggle(index)is wrong, the second parameter oftoggle()method is holding index. So you need to call liketoggle('', index)