MCPcopy Create free account
hub / github.com/Lobos/react-ui / renderToStringImpl

Function renderToStringImpl

docs/lib/react.js:13288–13309  ·  view source on GitHub ↗

* @param {ReactElement} element * @return {string} the HTML markup

(element, makeStaticMarkup)

Source from the content-addressed store, hash-verified

13286 * @return {string} the HTML markup
13287 */
13288function renderToStringImpl(element, makeStaticMarkup) {
13289 var transaction;
13290 try {
13291 ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
13292
13293 transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
13294
13295 return transaction.perform(function () {
13296 var componentInstance = instantiateReactComponent(element);
13297 var markup = componentInstance.mountComponent(transaction, null, ReactDOMContainerInfo(), emptyObject);
13298 if (!makeStaticMarkup) {
13299 markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
13300 }
13301 return markup;
13302 }, null);
13303 } finally {
13304 ReactServerRenderingTransaction.release(transaction);
13305 // Revert to the DOM batching strategy since these two renderers
13306 // currently share these stateful modules.
13307 ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
13308 }
13309}
13310
13311function renderToString(element) {
13312 !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : void 0;

Callers 2

renderToStringFunction · 0.85
renderToStaticMarkupFunction · 0.85

Calls 2

ReactDOMContainerInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…