Created
December 19, 2018 12:43
-
-
Save leocristofani/7e488dc88b56702276fb539b1ae6b8b4 to your computer and use it in GitHub Desktop.
Micro-frontends in practice - communication between services via custom DOM events - publish
This file contains 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
// ... | |
class ArtistsListItem extends React.Component { | |
onClick = (e) => { | |
//... | |
window.dispatchEvent( | |
new CustomEvent(ARTISTS_SELECT_ARTIST, { detail: { artist: name } }) | |
); | |
} | |
render() { | |
// ... | |
return ( | |
<button onClick={this.onClick}>{name}</button> | |
); | |
} | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment