Arian Hosseinzadeh Arian Hosseinzadeh - 4 months ago 44
Node.js Question

Getting rid of node-jsx

In the router of my NodeJS app, I want to render a react app. As it is not browserified (and there reactified) it returns

unexpected token <
error while building. I found if I
it doesn't return me this error.
is deprecated. Is there any way to build the project without requiring it ?

var JSX = require('node-jsx').install(),//as we don't reactify it while building
React = require('react'),
Board = React.createFactory(require('../components/board')),
DataStore = require('../store/store');

var router = require('express').Router();

router.get('/', function(req, res) {
var initialState = {'users': DataStore.getUsers()};
var markup = React.renderToString(
res.render('board', {
markup: markup,
state: JSON.stringify(initialState),
layout: 'boardLayout'

module.exports = router;


node-jsx has been deprecated in favor of babel. Instead of require('node-jsx').install();, you can now userequire('babel/register');.