Closed DB-Alex closed 5 years ago
This is definitely an interesting possibility. I've give it a try before, but one of the issues I ran into was that if there's an error during rendering, you can't change the header/status, as the status has already been sent near the top of the response. I'm not exactly sure how to deal with this, so I just stuck with renderToString in the template.
Thanks for your update!
I was just experimenting with renderToNodeStream in combination with CURA after reading this article: https://medium.com/expedia-group-tech/profiling-react-server-side-rendering-to-free-the-node-js-event-loop-7f0fe455a901
After changing the CURA setup from renderToString to renderToNodeStream my TTFB dropped by 50% (see attachments). So i thought this is nice to share with you @jamesknelson, also it would be nice to hear your thoughts about my new setup inside index.node.js, maybe I need to add error throwing?
Old setup:
New setup: