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

244
Views
How to pass component in React mui menuItem

I imported Report.js component and want to use it in "menuitem", I tried this in button and its working perfectly

 import Reports from 'new-components/Reports/Reports'   //ontop

 <Button> 
    <Reports pid={pid} />          //working
 </Button>

but when i tried this same in "menuitem" than its not working

<MenuItem >
  <Reports pid={pid} />            //not working
</MenuItem>

i also tried with onClick function, although it gives the desired result but also throws a error " Uncaught Error: Expected onClick listener to be a function, instead got a value of object type."

Reports.js

  return (
     <CSVLink {...csvReport}>Export CSV</CSVLink>
     )

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

0

You could try to pass your Reports element via the component prop of MenuItem:

const YourComponent = () => {
  return <MenuItem component={<Reports pid={pid} />} />;
}

https://mui.com/material-ui/api/menu-item/#props

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!