Skip to content

Instantly share code, notes, and snippets.

@sergiodxa
Created June 2, 2015 00:45
Show Gist options
  • Save sergiodxa/49bcd8318f72f98cb491 to your computer and use it in GitHub Desktop.
Save sergiodxa/49bcd8318f72f98cb491 to your computer and use it in GitHub Desktop.
Renderizar React.js a string para enviar el string desde Express.js
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