From 9a1c285c5a142419ee09d57147f7b94a5cb4eabc Mon Sep 17 00:00:00 2001 From: Patrick Stadler Date: Wed, 27 Jan 2016 09:39:30 +0100 Subject: [PATCH] Upgrade to react 0.14.x --- README.md | 4 ++-- index.js | 11 ++++++----- package.json | 8 +++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3c4f837..f4264d0 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ This is an [Express](http://expressjs.com) view engine for [React's](http://http ## Usage ``` -npm install express-react-engine react +npm install express-react-engine react react-dom ``` -Make sure you install **React** as a dependency. +Make sure you install `react` and `react-dom` as dependencies. ### Add it to your Express App diff --git a/index.js b/index.js index 2bd7308..1a66772 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; var React = require('react'); +var ReactDOMServer = require('react-dom/server'); var defaults = require('lodash.defaults'); var path = require('path'); @@ -26,9 +27,9 @@ module.exports = function engineFactory (engineOptions) { var componentMarkup; if (engineOptions.staticMarkup) { - componentMarkup = React.renderToStaticMarkup(instance); + componentMarkup = ReactDOMServer.renderToStaticMarkup(instance); } else { - componentMarkup = React.renderToString(instance); + componentMarkup = ReactDOMServer.renderToString(instance); } if (engineOptions.wrapper) { @@ -37,9 +38,9 @@ module.exports = function engineFactory (engineOptions) { body: componentMarkup, props: options }); - - markup += React.renderToStaticMarkup(wrapperInstance); - + + markup += ReactDOMServer.renderToStaticMarkup(wrapperInstance); + } else { markup += componentMarkup; } diff --git a/package.json b/package.json index fd46a8a..5573e2b 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,15 @@ }, "homepage": "https://github.com/magalhas/express-react-engine", "peerDependencies": { - "react": "^0.13.1" + "react": "^0.14.0", + "react-dom": "^0.14.0" }, "dependencies": { "babel": "^4.7.16", "lodash.defaults": "^3.1.0" }, "devDependencies": { - "react": "^0.13.1" - } + "react": "^0.14.0", + "react-dom": "^0.14.0" + }, }