<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');
}
}
);
};
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.)