Skip to content

Commit 66fc5fc

Browse files
committed
Update to React 0.14, Babel 6.0 and use Webpack in examples
1 parent 654db73 commit 66fc5fc

151 files changed

Lines changed: 94426 additions & 219690 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/01_hello_world/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react"]
3+
}

examples/01_hello_world/01_hello_world.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<div id="app"></div>
44

55
<script src="./react.js"></script>
6+
<script src="./react-dom.js"></script>
67
<script src="./01_hello_world_compiled.js"></script>
78
</body>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var HelloWorld = React.createClass({
22
render: function () {
3-
return <div>Hello World</div>
3+
return <div>Hello Oredev</div>
44
}
55
});
66

7-
React.render(<HelloWorld/>, document.getElementById('app'));
7+
ReactDOM.render(<HelloWorld/>, document.getElementById('app'));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var HelloWorld = React.createClass({
2+
render: function () {
3+
return React.createElement(
4+
'div',
5+
null,
6+
'Hello Oredev'
7+
);
8+
}
9+
});
10+
11+
ReactDOM.render(React.createElement(HelloWorld, null), document.getElementById('app'));
12+

examples/01_hello_world/Makefile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
install_react_tools:
2-
npm install --global --update react-tools
1+
install_babel:
2+
npm install --global --update babel-cli
3+
npm install
34

45
download_react:
5-
curl -s -L https://fb.me/react-0.13.3.js -o react.js
6+
curl -s -L https://fb.me/react-0.14.2.js -o react.js
7+
curl -s -L https://fb.me/react-dom-0.14.2.js -o react-dom.js
68

79
compile:
8-
jsx 01_hello_world.js > 01_hello_world_compiled.js
9-
10-
open:
11-
open 01_hello_world.html
12-
13-
start:
14-
start 01_hello_world.html
10+
babel 01_hello_world.js > 01_hello_world_compiled.js
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "01_hello_world",
3+
"version": "1.0.0",
4+
"description": "Look at the different rules in Makefile.",
5+
"main": "01_hello_world.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"compile": "babel 01_hello_world.js > 01_hello_world_compiled.js"
9+
},
10+
"keywords": [],
11+
"author": "",
12+
"license": "ISC",
13+
"devDependencies": {
14+
"babel-cli": "^6.0.15",
15+
"babel-preset-react": "^6.0.15"
16+
}
17+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* ReactDOM v0.14.2
3+
*
4+
* Copyright 2013-2015, Facebook, Inc.
5+
* All rights reserved.
6+
*
7+
* This source code is licensed under the BSD-style license found in the
8+
* LICENSE file in the root directory of this source tree. An additional grant
9+
* of patent rights can be found in the PATENTS file in the same directory.
10+
*
11+
*/
12+
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
13+
;(function(f) {
14+
// CommonJS
15+
if (typeof exports === "object" && typeof module !== "undefined") {
16+
module.exports = f(require('react'));
17+
18+
// RequireJS
19+
} else if (typeof define === "function" && define.amd) {
20+
define(['react'], f);
21+
22+
// <script>
23+
} else {
24+
var g
25+
if (typeof window !== "undefined") {
26+
g = window;
27+
} else if (typeof global !== "undefined") {
28+
g = global;
29+
} else if (typeof self !== "undefined") {
30+
g = self;
31+
} else {
32+
// works providing we're not in "use strict";
33+
// needed for Java 8 Nashorn
34+
// see https://github.com/facebook/react/issues/3037
35+
g = this;
36+
}
37+
g.ReactDOM = f(g.React);
38+
}
39+
40+
})(function(React) {
41+
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
42+
});

0 commit comments

Comments
 (0)