title: Using renderToNodeStream with react-helmet
body: <p>I am currently creating a website and have been looking to start using <code>renderToNodeStream</code> to increase the performance of the server side rendering instead of using <code>renderToString</code>. </p>
  
  <p>At the moment I am using <code>renderToString</code> and then using <code>Helmet.renderStatic</code> to get all the required meta data and title from each of the pages. When I switch to using <code>renderToNodeStream</code> however, I will be writing to the head prior to rendering anything, and so can no longer use <code>Helmet.renderStatic</code> anymore.</p>
  
  <p>I was thinking I could do the below to solve this issue, but this involves first using <code>renderToString</code> before then using <code>renderToNodeStream</code>, and probably doesn't really provide much improvement...</p>
  
  <pre><code>app.use('*', (req, res) {
    Loadable.preloadAll().then(() =&gt; {
      const store = createStore(
        reducers,
        getDefaultStateFromProps(),
        applyMiddleware(thunk)
      );
      const routeContext = {};
      const router = (
        &lt;Provider store={store}&gt;
          &lt;StaticRouter location={req.url} context={routeContext}&gt;
            &lt;App/&gt;
          &lt;/StaticRouter&gt;
        &lt;/Provider&gt;
      );
  
      res.setHeader('Content-Type', 'text/html');
  
      renderToString(router);
      const helmet = Helmet.renderStatic();
  
      res.locals.title = helmet.title;
      res.locals.meta = helmet.meta;
      res.locals.link = helmet.link;
  
      res.write(headTemplate(res.locals));
  
      const stream = renderToNodeStream(router);
  
      stream.pipe(res, { end: false });
      stream.on('end', () =&gt; {
        res.locals.context = JSON.stringify(store.getState());
        res.end(bodyTemplate(res.locals));
      });
    });
  }
  </code></pre>
  
  <p>Does anyone know how to get around this issue?</p>