()
| 57 | } |
| 58 | |
| 59 | function prerender() { |
| 60 | setStatus('Generating markup'); |
| 61 | |
| 62 | return Promise.resolve() |
| 63 | .then(function () { |
| 64 | const element = createElement(Fixture); |
| 65 | |
| 66 | // Server rendering moved to a separate package along with ReactDOM |
| 67 | // in 0.14.0 |
| 68 | if (needsReactDOM) { |
| 69 | return ReactDOMServer.renderToString(element); |
| 70 | } |
| 71 | |
| 72 | // React.renderComponentToString was renamed in 0.12 |
| 73 | if (React.renderToString) { |
| 74 | return React.renderToString(element); |
| 75 | } |
| 76 | |
| 77 | // React.renderComponentToString became synchronous in React 0.9.0 |
| 78 | if (React.renderComponentToString.length === 1) { |
| 79 | return React.renderComponentToString(element); |
| 80 | } |
| 81 | |
| 82 | // Finally, React 0.4 and lower emits markup in a callback |
| 83 | return new Promise(function (resolve) { |
| 84 | React.renderComponentToString(element, resolve); |
| 85 | }); |
| 86 | }) |
| 87 | .then(function (string) { |
| 88 | output.innerHTML = string; |
| 89 | setStatus('Markup only (No React)'); |
| 90 | }) |
| 91 | .catch(handleError); |
| 92 | } |
| 93 | |
| 94 | function render() { |
| 95 | setStatus('Hydrating'); |
no test coverage detected