mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
64d4b84204
* Rename Flight to Transport Flight is still the codename for the implementation details (like Fiber). However, now the public package is react-transport-... which is only intended to be used directly by integrators. * Rename names
27 lines
530 B
JavaScript
27 lines
530 B
JavaScript
'use strict';
|
|
|
|
const ReactTransportDOMServer = require('react-transport-dom-webpack/server');
|
|
const React = require('react');
|
|
const Stream = require('stream');
|
|
|
|
function Text({children}) {
|
|
return <span>{children}</span>;
|
|
}
|
|
|
|
function HTML() {
|
|
return (
|
|
<div>
|
|
<Text>Hello</Text>
|
|
<Text>world</Text>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
module.exports = function(req, res) {
|
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
let model = {
|
|
content: <HTML />,
|
|
};
|
|
ReactTransportDOMServer.pipeToNodeWritable(model, res);
|
|
};
|