Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Split contact form rendering into two lines
Browse files Browse the repository at this point in the history
  • Loading branch information
juampynr committed Aug 1, 2015
1 parent fc483cf commit edcbca6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var bodyParser = require('body-parser');
var express = require('express');
var app = express();
var React = require('react');
var ContactForm = React.createFactory(require('./src/contact-form.jsx'));
var ContactFormFactory = React.createFactory(require('./src/contact-form.jsx'));

// Exposes public assets such as index.html and JavaScript files.
app.use(express.static('public'));
Expand All @@ -24,7 +24,8 @@ app.set('view engine', 'jade');

// Returns the contact form.
app.get('/', function (req, res) {
res.render('index', { Content: React.renderToString(ContactForm({}))});
var ContactForm = React.renderToString(ContactFormFactory());
res.render('index', { Content: ContactForm });
});

// Adds support for JSON-encoded bodies used in POST requests.
Expand Down

0 comments on commit edcbca6

Please sign in to comment.