I'm trying to select through menu in react and get the item's Id.
The Structure is
FormControl
Select
MenuItem
MenuItem
MenuItem
I set the MenuItem 'key' property to some value and I want to reach it in the Select 'onChange' function but I can only seem to get the value of the MenuItem.
Since the code is private I can't share it, but I'm trying to get the logic behind a process like I described above.
The key prop is just used by React, and isn't meant to be used by you. It looks like you're using MaterialUI. If there's some data you need passed to <MenuItem />'s, one possibility is to create you're own MenuItem component that extends MaterialUI's, so that you can pass whatever data it is that you need as a prop, and also pass a function to it as another prop so that you can have more control over what is shared between the component and it's parent. Hopefully that's helpful without having more info about the code.