Prebinding onpress event in typescript

181 views Asked by At

I have a question how I can pre-bind onpress event and pass attribute with it?

Example:

const blockReasonToggles = _.map(ReportReasonCodes, reason => {
return (
    <RX.Button
        style={ _styles.checkboxView }
        onPress={ () => this._onReasonPressed(reason) }
    </RX.Button>
  );
});

One way is to create new component and pass prop to it, but in this way there is problem with sharing state between components.

0

There are 0 answers