mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #6139 from mxstbr/fix-rendertostaticmarkup-invariant
Fix renderToStaticMarkup() invariant
This commit is contained in:
@@ -28,11 +28,6 @@ var invariant = require('invariant');
|
||||
* @return {string} the HTML markup
|
||||
*/
|
||||
function renderToStringImpl(element, makeStaticMarkup) {
|
||||
invariant(
|
||||
ReactElement.isValidElement(element),
|
||||
'renderToString(): You must pass a valid ReactElement.'
|
||||
);
|
||||
|
||||
var transaction;
|
||||
try {
|
||||
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
||||
@@ -61,10 +56,18 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
||||
}
|
||||
|
||||
function renderToString(element) {
|
||||
invariant(
|
||||
ReactElement.isValidElement(element),
|
||||
'renderToString(): You must pass a valid ReactElement.'
|
||||
);
|
||||
return renderToStringImpl(element, false);
|
||||
}
|
||||
|
||||
function renderToStaticMarkup(element) {
|
||||
invariant(
|
||||
ReactElement.isValidElement(element),
|
||||
'renderToStaticMarkup(): You must pass a valid ReactElement.'
|
||||
);
|
||||
return renderToStringImpl(element, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ describe('ReactServerRendering', function() {
|
||||
'not a component'
|
||||
)
|
||||
).toThrow(
|
||||
'renderToString(): You must pass a valid ReactElement.'
|
||||
'renderToStaticMarkup(): You must pass a valid ReactElement.'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user