Skip to content

Commit

Permalink
Merge pull request #10 from pstadler/react-0.14
Browse files Browse the repository at this point in the history
Upgrade to React 0.14.x
  • Loading branch information
magalhas committed Jan 27, 2016
2 parents d6caf51 + 9a1c285 commit 60bc098
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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) {
Expand All @@ -37,9 +38,9 @@ module.exports = function engineFactory (engineOptions) {
body: componentMarkup,
props: options
});
markup += React.renderToStaticMarkup(wrapperInstance);

markup += ReactDOMServer.renderToStaticMarkup(wrapperInstance);

} else {
markup += componentMarkup;
}
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
}

0 comments on commit 60bc098

Please sign in to comment.