Skip to content

Instantly share code, notes, and snippets.

@gr0uch
Created February 27, 2015 20:47
Show Gist options
  • Save gr0uch/da8cd99776ec2b1a01ed to your computer and use it in GitHub Desktop.
Save gr0uch/da8cd99776ec2b1a01ed to your computer and use it in GitHub Desktop.
One-line dependency injection in ES6
/**
* Dependency injection in ES6. Parentheses can be omitted for arrow functions with
* only one argument, and by omitting the curly braces it automatically returns
* the proceeding expression, in this case, the Subclass that extends from the
* Superclass that is injected. So cool.
*/
export default Superclass => class Subclass extends Superclass { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment