Created
June 27, 2014 20:31
-
-
Save tgriesser/db8330e04f27ae5ac077 to your computer and use it in GitHub Desktop.
renderComponentToInstance
This file contains hidden or 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
// Added In ReactServerRendering.js | |
function renderComponentToInstance(component) { | |
var transaction; | |
try { | |
var id = ReactInstanceHandles.createReactRootID(); | |
transaction = ReactServerRenderingTransaction.getPooled(false); | |
return transaction.perform(function() { | |
var componentInstance = instantiateReactComponent(component); | |
componentInstance.mountComponent(id, transaction, 0); | |
return componentInstance._renderedComponent; | |
}, null); | |
} finally { | |
ReactServerRenderingTransaction.release(transaction); | |
} | |
} | |
module.exports = { | |
renderComponentToInstance: renderComponentToInstance, | |
renderComponentToString: renderComponentToString, | |
renderComponentToStaticMarkup: renderComponentToStaticMarkup | |
}; | |
// Then: | |
var component = React.renderComponentToInstance(Component({props: arg})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment