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

200
Views
How to pass multiple properties to a function React
<DeleteForeverIcon
  className={classes.deleteHwIcon}
  onClick={() => {
    deleteHw(value.name);
  }}
/>

Is there way to add another property to where it says deleteHw. So instead of just passing value.name to the function deleteHw I'd also like to pass value.class. Here is the function the properties are being passed to:

const deleteHw = (homework) => {
  Axios.delete(`http://localhost:1337/api/deleteHomework/${homework}`).then(
    (response) => {
      if (response) {
        console.log(response);
      } else {
        console.log('error');
      }
    }
  );
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do something like

deleteHw(value.name, value.class)

but you'll need to change the function to look like the following

const deleteHw = (homework, secondParamName) =>

in order to accept the second parameter. (You'd also likely want to modify the function body to use the second parameter, but as you haven't described what the second parameter is supposed to do, I can't advise on that.)

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!