Created
December 8, 2016 12:10
-
-
Save jide/6844321a18986f0f1a023da19768c196 to your computer and use it in GitHub Desktop.
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
wire(TodoList) |
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
function wire(type) { | |
const WrappedComponent = type; | |
class FinalComponent extends WrappedComponent { | |
componentDidMount() { | |
// Subscribe | |
} | |
componentWillUnmount() { | |
// Unsubscribe | |
} | |
} | |
// Store a reference to the connected component so we can create an element of it instead of the | |
// original type in createElement(). | |
WrappedComponent[COMPONENT] = FinalComponent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment