Created
October 22, 2015 16:46
-
-
Save jasonneylon/ea5ea2fa79c97f86e693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// publish an event when a user selects and address in our React component | |
onAddressSelected(addressIndex) { | |
this.state.selectedAddressIndex = addressIndex; | |
this.state.address = Object.assign({}, this.state.addresses[index]); | |
this.setState(this.state); | |
// using tinypubsub to wrap our js events | |
$.publish('address.selected', {address: this.state.address, type: this.props.addressType}); | |
} | |
.... | |
// subscrite in the page's JavaScript code | |
$.subscribe('address.selected', function(e, address) { | |
// update the form using jquery | |
... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment