[Menu] MenuItem onClick doesn't pass proper argument #11625
Labels
component: menu
This is the name of the generic UI component, not the React module!
support: question
Community support but can be turned into an improvement
In my component I have a
Table
with mappedTableRow
from some custom array of objects. In the lastTableCell
I want to have a icon button thatonClick
opensMenu
with someMenuItem
actions (edit and delete). The problem is that theonClick
event of theMenuItem
is always passing the last array element and not the one mapped to that particularTableRow
.Expected Behavior
The
onClick
on theMenuItem
should pass as an argument the appropriate array element when it is used inside map function.Current Behavior
The
onClick
on theMenuItem
is passing as an argument the last element in the array that is being mapped.Steps to Reproduce (for bugs)
Sandbox example:
https://codesandbox.io/s/0x8lnylqj0
Your Environment
The text was updated successfully, but these errors were encountered: