I have a function
doSomething = (id) => {
console.log(id)
}
I want to call this function inside onPress. I know one way to do this is by using another arrow function inside onPress like this:
<Text onPress={() => this.doSomething(id)}>Do Some Work</Text>
But then a new function is created in every re-render and decreases peformance which can be avoided by calling functions like this onPress={this.doSomething} only when there is no argument to be passed. Is a similar thing possible with arguments so that I can improve the performance of my app