Skip to content

Instantly share code, notes, and snippets.

@gbabiars
Last active April 10, 2019 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbabiars/46412f7f5148a9a05f2f0e2b01c258ee to your computer and use it in GitHub Desktop.
Save gbabiars/46412f7f5148a9a05f2f0e2b01c258ee to your computer and use it in GitHub Desktop.
// In JSX, callback can get passed directly as part of api
<MyComponent onSomething={handler} />
// With events, there is a disconnect between the event publisher and the consumer of the event
<my-component></my-component>
// Some parent, but could be multiple, hard to follow
let myComponent = this.querySelector('my-component');
myComponent.addEventListener('something', handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment