Closed wingleung closed 6 years ago
Can they be polyfilled for older versions of React?
That's core react functionality that will need to be polyfilled, possibily adding another lib for all the streaming logic.
Could we maybe fallback to renderReact
and renderReactStatic
?
Right, I think it'd be ok to provide a stream for the result even if it wasn't "streaming"
We can expose both APIs and if their version of ReactDOMServer doesn't have a renderToNodeStream
method then it'll throw.
That's certainly one approach; it'd be better if we could wrap it in a stream in that case, instead.
I agree with exposing both apis and falling back on a wrapped stream in renderTo(Static)NodeStream if React < 16.
However I just tried the stream functionality in my project and it seems hypernova always sends back a string which makes stream support impossible without a change in the hypernova-node code.
See code in https://github.com/airbnb/hypernova-node/issues/29
You can make a stream around a single string just fine; it won't have any performance benefits but the API will be the same.
closing as this is not relevant to me anymore, we solved the streaming by just using Varnish streaming capabilities with ESI more info -> https://medium.com/vrt-digital-studio/server-side-rendering-react-components-as-a-service-9d6b887cb02a
In React 16 2 new streaming methods were introduced:
renderToNodeStream
renderToStaticNodeStream
Should these functionalities be added to hypernova-react?