title: Syntax Error: Unexpected token < while using renderToString(<RoutingContext {...renderProps} />
body: <p>I am trying to use React &amp; React-router for server side rendering. So far, it's just a copy paste code from various sources. But I am getting syntax error (Not run-time error) when I try to run the app using node. Below is the code</p>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>'use strict';
  require('babel/register');
  
  const express        = require('express');
  const http           = require('http');
  const handlebars     = require('express-handlebars');
  const renderToString = require('react-dom').server;
  const match          = require('react-router').match;
  const RoutingContext = require('react-router').RoutingContext;
  const Routes         = require('./routes');
  const app            = express();
  var server;
  
  // JSX transpilation
  require('node-jsx').install();
  
  // Setting up handlebars
  app.engine('.hbs', handlebars({
      extname: '.hbs',
      layoutsDir: 'views/server',
      partialsDir: 'views/server/partials'
  }));
  
  app.set('view engine', '.hbs');
  
  // Mount Routes
  app.use('*', function (req, res) {
      match({routes: routes, location: req.url}, (error, redirectLocation, renderProps) =&gt; {
          if (error) {
            res.status(500).send(error.message)
          } else if (redirectLocation) {
            res.redirect(302, redirectLocation.pathname + redirectLocation.search)
          } else if (renderProps) {
              console.log(renderProps);
              var pageData = {
                  serverHtml: renderToString(&lt;RoutingContext {...renderProps} /&gt;)
              };
              console.log(pageData);
              res.render('base', pageData);
          } else {
            res.status(404).send('Not found')
          }
      });
  });
  
  server = http.createServer(app);
  
  server.listen('3000', () =&gt; {
      console.log('Express server listening on port ' + 3000);
  });
  </code></pre>
  
  <p>The Error that I get while running <code>node --harmony app.js</code> is</p>
  
  <pre><code>serverHtml: renderToString(&lt;RoutingContext {...renderProps} /&gt;)
                                         ^
  SyntaxError: Unexpected token &lt;
      at exports.runInThisContext (vm.js:73:16)
      at Module._compile (module.js:443:25)
      at Object.Module._extensions..js (module.js:478:10)
      at Module.load (module.js:355:32)
      at Function.Module._load (module.js:310:12)
      at Function.Module.runMain (module.js:501:10)
      at startup (node.js:129:16)
      at node.js:814:3
  </code></pre>
  
  <p>Do I need to install/transform(babelify/jsx) my code for processing the JSX style tags? But I didn't found any such thing stated in any tutorials online.</p>
  
  <p>Resources I followed</p>
  
  <ol>
  <li><a href="https://github.com/rackt/react-router/blob/master/docs/guides/advanced/ServerRendering.md" rel="nofollow">React-router(Serverside Rendering)</a></li>
  <li><a href="https://ifelse.io/2015/08/27/server-side-rendering-with-react-and-react-router/" rel="nofollow">Server Side Rendering by React</a></li>
  </ol>