mercredi 1 mai 2019

If within map function: Getting unexpected error

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!

Aucun commentaire:

Enregistrer un commentaire