My (simplified) React component looks like:
import React from 'react';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
export default function MyList(setPanel) {
const handleClick = () => {
console.log(setPanel);
setPanel('support');
};
return (
<List>
<ListItem button key="Support" onClick={handleClick}>
<ListItemText primary="Support" />
</ListItem>
</List>
);
}
and the console log is showing setPanel to be a function but then I'm getting a
TypeError: setPanel is not a function
when I click on the ListItem in the app. What am I missing here?