Skip to content

Instantly share code, notes, and snippets.

@jide
Created December 8, 2016 12:10
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 jide/6844321a18986f0f1a023da19768c196 to your computer and use it in GitHub Desktop.
Save jide/6844321a18986f0f1a023da19768c196 to your computer and use it in GitHub Desktop.
wire(TodoList)
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