Here is the code snippet that I am having trouble with:
<DetailsBox title={t('catalogPage.componentDetails.specs.used')}>
{component?.projects.map(project => {
projectList?.map(name => {
if (project.id === name.id) {
return (
<Typography variant="body2" gutterBottom classes={{}}>
{`${name.name}`}
</Typography>
);
}
});
})}
</DetailsBox>
I encountered an error which says
Expected to return a value at the end of arrow function
. I understand that this is because of the return
in an anonymous function, but how can I refactor it to fix the issue?
Edit: The error points to this specific line: projectList?.map(name => {