Created
January 4, 2015 23:31
-
-
Save elierotenberg/6da11c21ce0a1c5420d8 to your computer and use it in GitHub Desktop.
renderToObject
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 renderToObject(element) { | |
const inst = instantiateReactComponent(element); | |
inst.state = inst.getInitialState ? inst.getInitialState() : null; | |
return Promise.resolve(inst.componentWillMount ? inst.componentWillMount() : null) | |
.then(() => { | |
const r = inst.render(); | |
inst.componentWillUnmount(); | |
return r; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment