Created
February 27, 2015 20:47
-
-
Save gr0uch/da8cd99776ec2b1a01ed to your computer and use it in GitHub Desktop.
One-line dependency injection in ES6
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
/** | |
* 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