[examples] Update basic-commonjs for new React, watchify
This commit is contained in:
parent
f1ede3e6d2
commit
145ca279f9
|
@ -2,6 +2,8 @@
|
|||
|
||||
Run `npm install` in the directory to install React from npm. Then run:
|
||||
|
||||
./node_modules/.bin/browserify --debug --transform reactify ./index.js > ./bundle.js
|
||||
```sh
|
||||
npm start
|
||||
```
|
||||
|
||||
to produce `bundle.js` with example code and React.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<h4>Example Details</h4>
|
||||
<p>This is written with JSX in a CommonJS module and precompiled to vanilla JS by running:</p>
|
||||
<pre>browserify --debug --transform reactify index.js > bundle.js</pre>
|
||||
<pre>npm start</pre>
|
||||
<p>
|
||||
Learn more about React at
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
|
||||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
|
@ -16,7 +17,7 @@ var ExampleApplication = React.createClass({
|
|||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
"name": "react-basic-commonjs-example",
|
||||
"description": "Basic example of using React with CommonJS",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"browserify": "^6.3.3",
|
||||
"react": "^0.13.0",
|
||||
"reactify": "^0.17.1"
|
||||
"dependencies": {
|
||||
"babelify": "^6.3.0",
|
||||
"react": "^0.14.0-rc1",
|
||||
"react-dom": "^0.14.0-rc1",
|
||||
"watchify": "^3.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify --debug --transform reactify index.js > bundle.js"
|
||||
"start": "watchify index.js -v -t babelify -o bundle.js"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue