Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Can't access MenuItem property in Select React

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!