I have two buttons that both call the same onPress function. In the callback I want to be able to differentiate between which was pressed.
<MKRadioButton
title='A'
group={this.radioGroup}
onPress={this._toggle}
/>
<MKRadioButton
title='B'
group={this.radioGroup}
onPress={this._toggle}
/>
then the call
_toggle(event) {
//what should go here to figure out if title A or B was called?
}
To improve performance, you can bind the event handler in the constructor to have it rendered only once
Facebook tip (at the bottom of the page)
One solution is to pass that info as a parameter:
The callback would then use that parameter
EDIT: Another solution is a parent component that always returns the title prop: