I have a function that is mapping then running a forEach to return a result. this function works fine in a plain js html file. but in React im getting the expected assignment or function call error
Here is the code
const customContactValues = fiftyContacts?.map((contact) => {
let result = {};
// this line is giving error
mentionReformat?.forEach((mention) => { result[mention.name] = valueByKey(contact, mention.name) } ); return result
});