Created
June 2, 2015 00:45
-
-
Save sergiodxa/49bcd8318f72f98cb491 to your computer and use it in GitHub Desktop.
Renderizar React.js a string para enviar el string desde Express.js
This file contains hidden or 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
import express from 'express'; | |
import React from 'react'; | |
import Home from './views/home'; | |
const app = express(); | |
app.get('/', (req, res) => { | |
const html = React.renderToString(<Home />); | |
res.send(html); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment