-
-
Save bsalex/2fabddbb194311d9cf94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react/addons') | |
var ButtonGroup = require('./buttons').ButtonGroup | |
React.render( | |
<ButtonGroup />, | |
document.querySelector('#example') | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "reactm", | |
"version": "1.0.0", | |
"description": "Reactjs NPM tools and so on", | |
"main": "server.js", | |
"dependencies": { | |
"browserify": "^7.0.0", | |
"enchilada": "^0.11.0", | |
"node-jsx": "^0.12.4", | |
"react": "^0.12.1", | |
"react-tools": "^0.12.1", | |
"express": "^4.10.6", | |
"reactify": "^0.17.1" | |
}, | |
"author": "Y.Voloshchuk", | |
"license": "ISC" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express() | |
var React = require('react') | |
var enchilada = require('enchilada') | |
var reactify = require('reactify') | |
require('node-jsx').install() | |
var ButtonGroup = React.createFactory(require('./buttons.js').ButtonGroup) | |
app.get('/', function(req, res){ | |
var html = React.renderToString(ButtonGroup({})) | |
var data = '' + | |
'<div id=example>' + html + '</div>' + | |
'<script src="/main.js"></script>' | |
res.send(data) | |
}) | |
app.use(enchilada({ | |
src: __dirname, // location of your js files | |
debug: true, | |
transforms: [ reactify ] | |
})) | |
app.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment