I get an unexpected error while following some code examples which I found online. I assume I have made some mistake, but comparing to other examples here, I cannot find the mistake. I am trying to include an if function within a map function:
const compProfileRemoveHandler = compProfileId => {
todoList.map(profile =>(
if (profile.id !== compProfileId) {some code}
))};
Does anyone know why I get the following error: "Parsing error: Unexpected token" (and the 'if' is marked under the statement).
Many thanks for your help!
.map(profile => { if ..})- also you must always return something from yourmapmethod or you'll getundefinedas your element