Okay, straight to the point, I've heard that using arrow function is not ideal when used on render. Most people recommended to either use bind and normal function, or keeps using arrow function and use the parameter from the props.
But what if I have an array of objects that I iterate using Object.Values(myObjects).map(object => {...}) then I want to use the object as a parameter to the function I created before render.
class Card extends Component {
onCardPress = (message) =>{
alert(message)
}
render(){
const { messages }; //from somewhere
return(
{Object.values(messages).map(message =>
<TouchableOpacity
activeOpacity={0.8}
onPress={()=>{onCardPress(message)}}
/>
}
)
}
}
One of the discussion that I read: Pass parameters to prop function without using an arrow function