Reputation: 1334
I know I can put multiple functions inside an event handler like this:
onClick={() => {function1(); function2()}}
If I need two props inside an event handler, can it be done the same way?
onClick={() => {this.props.prop1(); this.props.prop2()}}
Or should they be combined into a single prop prior?
Upvotes: 1
Views: 75
Reputation: 9358
Merging them will increase readability
combinedFunction(){
this.props.prop1();
this.props.prop2()
}
onClick={this.combinedFunction}
Upvotes: 1