mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
* Move Flight DOM to Webpack Specific Packagee We'll have Webpack specific coupling so we need to ensure that it can be versioned separately from various Webpack versions. We'll also have builds for other bundlers in the future. * Move to peerDep * Move DOM Flight Tests * Merge ReactFlightIntegration into ReactFlightDOM This was an integration test. We can add to it. * Fix fixture paths
29 lines
544 B
JavaScript
29 lines
544 B
JavaScript
'use strict';
|
|
|
|
const ReactFlightDOMServer = require('react-flight-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: <HTML />,
|
|
},
|
|
};
|
|
ReactFlightDOMServer.pipeToNodeWritable(model, res);
|
|
};
|