@samitouri / QOS-React-2 / commits / 145ca279f9

[examples] Update basic-commonjs for new React, watchify

Paul O’Shannessy committed Sep 18, 2015 at 18:24 UTC 145ca279f982df464e09845bd6ed7a73f9cff877
4 files changed +12 -8
examples/basic-commonjs/README.md
+3 -1
@@ -2,6 +2,8 @@
2
3 Run `npm install` in the directory to install React from npm. Then run:
4
5 - ./node_modules/.bin/browserify --debug --transform reactify ./index.js > ./bundle.js
5 +```sh
6 +npm start
7 +```
8
9 to produce `bundle.js` with example code and React.
examples/basic-commonjs/index.html
+1 -1
@@ -19,7 +19,7 @@
19 </div>
20 <h4>Example Details</h4>
21 <p>This is written with JSX in a CommonJS module and precompiled to vanilla JS by running:</p>
22 - <pre>browserify --debug --transform reactify index.js &gt; bundle.js</pre>
22 + <pre>npm start</pre>
23 <p>
24 Learn more about React at
25 <a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
examples/basic-commonjs/index.js
+2 -1
@@ -1,6 +1,7 @@
1 'use strict';
2
3 var React = require('react');
4 +var ReactDOM = require('react-dom');
5
6 var ExampleApplication = React.createClass({
7 render: function() {
@@ -16,7 +17,7 @@ var ExampleApplication = React.createClass({
17 var start = new Date().getTime();
18
19 setInterval(function() {
19 - React.render(
20 + ReactDOM.render(
21 <ExampleApplication elapsed={new Date().getTime() - start} />,
22 document.getElementById('container')
23 );
examples/basic-commonjs/package.json
+6 -5
@@ -2,12 +2,13 @@
2 "name": "react-basic-commonjs-example",
3 "description": "Basic example of using React with CommonJS",
4 "main": "index.js",
5 - "devDependencies": {
6 - "browserify": "^6.3.3",
7 - "react": "^0.13.0",
8 - "reactify": "^0.17.1"
5 + "dependencies": {
6 + "babelify": "^6.3.0",
7 + "react": "^0.14.0-rc1",
8 + "react-dom": "^0.14.0-rc1",
9 + "watchify": "^3.4.0"
10 },
11 "scripts": {
11 - "build": "browserify --debug --transform reactify index.js > bundle.js"
12 + "start": "watchify index.js -v -t babelify -o bundle.js"
13 }
14 }