@samitouri / QOS-React-2 / commits / f53854bd93

React.renderComponent -> React.render

This covers most everything. The perf suite still needs work for the Element updates. And the server rendering example needs to be done wholesale.

Paul O’Shannessy committed Oct 22, 2014 at 18:30 UTC f53854bd9321006e11e0ce7d48c7af3e83fd8359
31 files changed +50 -50
README.md
+1 -1
@@ -19,7 +19,7 @@ var HelloMessage = React.createClass({
19 }
20 });
21
22 -React.renderComponent(
22 +React.render(
23 <HelloMessage name="John" />,
24 document.getElementById('container')
25 );
docs/_js/examples/hello.js
+2 -2
@@ -5,10 +5,10 @@ var HelloMessage = React.createClass({\n\
5 }\n\
6 });\n\
7 \n\
8 -React.renderComponent(<HelloMessage name=\"John\" />, mountNode);\
8 +React.render(<HelloMessage name=\"John\" />, mountNode);\
9 ";
10
11 -React.renderComponent(
11 +React.render(
12 <ReactPlayground codeText={HELLO_COMPONENT} />,
13 document.getElementById('helloExample')
14 );
docs/_js/examples/markdown.js
+2 -2
@@ -28,10 +28,10 @@ var MarkdownEditor = React.createClass({\n\
28 }\n\
29 });\n\
30 \n\
31 -React.renderComponent(<MarkdownEditor />, mountNode);\
31 +React.render(<MarkdownEditor />, mountNode);\
32 ";
33
34 -React.renderComponent(
34 +React.render(
35 <ReactPlayground codeText={MARKDOWN_COMPONENT} />,
36 document.getElementById('markdownExample')
37 );
docs/_js/examples/timer.js
+2 -2
@@ -19,10 +19,10 @@ var Timer = React.createClass({\n\
19 }\n\
20 });\n\
21 \n\
22 -React.renderComponent(<Timer />, mountNode);\
22 +React.render(<Timer />, mountNode);\
23 ";
24
25 -React.renderComponent(
25 +React.render(
26 <ReactPlayground codeText={TIMER_COMPONENT} />,
27 document.getElementById('timerExample')
28 );
docs/_js/examples/todo.js
+2 -2
@@ -33,10 +33,10 @@ var TodoApp = React.createClass({\n\
33 );\n\
34 }\n\
35 });\n\
36 -React.renderComponent(<TodoApp />, mountNode);\
36 +React.render(<TodoApp />, mountNode);\
37 ";
38
39 -React.renderComponent(
39 +React.render(
40 <ReactPlayground codeText={TODO_COMPONENT} />,
41 document.getElementById('todoExample')
42 );
docs/_js/html-jsx.js
+1 -1
@@ -78,5 +78,5 @@ var HELLO_COMPONENT = "\
78 }
79 });
80
81 - React.renderComponent(<HTMLtoJSXComponent />, document.getElementById('jsxCompiler'));
81 + React.render(<HTMLtoJSXComponent />, document.getElementById('jsxCompiler'));
82 }());
docs/_js/jsx-compiler.js
+2 -2
@@ -5,7 +5,7 @@ var HelloMessage = React.createClass({\n\
5 }\n\
6 });\n\
7 \n\
8 -React.renderComponent(<HelloMessage name=\"John\" />, mountNode);\
8 +React.render(<HelloMessage name=\"John\" />, mountNode);\
9 ";
10
11 function transformer(harmony, code) {
@@ -39,7 +39,7 @@ var CompilerPlayground = React.createClass({
39 );
40 },
41 });
42 -React.renderComponent(
42 +React.render(
43 <CompilerPlayground />,
44 document.getElementById('jsxCompiler')
45 );
docs/_js/live_editor.js
+2 -2
@@ -190,7 +190,7 @@ var ReactPlayground = React.createClass({
190 try {
191 var compiledCode = this.compileCode();
192 if (this.props.renderCode) {
193 - React.renderComponent(
193 + React.render(
194 <CodeMirrorEditor codeText={compiledCode} readOnly={true} />,
195 mountNode
196 );
@@ -199,7 +199,7 @@ var ReactPlayground = React.createClass({
199 }
200 } catch (err) {
201 this.setTimeout(function() {
202 - React.renderComponent(
202 + React.render(
203 <div className="playgroundError">{err.toString()}</div>,
204 mountNode
205 );
examples/ballmer-peak/example.js
+1 -1
@@ -38,7 +38,7 @@ var BallmerPeakCalculator = React.createClass({
38 }
39 });
40
41 -React.renderComponent(
41 +React.render(
42 <BallmerPeakCalculator />,
43 document.getElementById('container')
44 );
examples/basic-commonjs/index.js
+1 -1
@@ -18,7 +18,7 @@ var ExampleApplication = React.createClass({
18 var start = new Date().getTime();
19
20 setInterval(function() {
21 - React.renderComponent(
21 + React.render(
22 <ExampleApplication elapsed={new Date().getTime() - start} />,
23 document.getElementById('container')
24 );
examples/basic-jsx-external/example.js
+1 -1
@@ -15,7 +15,7 @@ var ExampleApplication = React.createClass({
15 var start = new Date().getTime();
16
17 setInterval(function() {
18 - React.renderComponent(
18 + React.render(
19 <ExampleApplication elapsed={new Date().getTime() - start} />,
20 document.getElementById('container')
21 );
examples/basic-jsx-harmony/index.html
+1 -1
@@ -41,7 +41,7 @@
41 });
42 var start = new Date().getTime();
43 setInterval(() => {
44 - React.renderComponent(
44 + React.render(
45 <ExampleApplication elapsed={new Date().getTime() - start} />,
46 document.getElementById('container')
47 );
examples/basic-jsx-precompile/example.js
+1 -1
@@ -15,7 +15,7 @@ var ExampleApplication = React.createClass({
15 var start = new Date().getTime();
16
17 setInterval(function() {
18 - React.renderComponent(
18 + React.render(
19 <ExampleApplication elapsed={new Date().getTime() - start} />,
20 document.getElementById('container')
21 );
examples/basic-jsx/index.html
+1 -1
@@ -44,7 +44,7 @@
44 });
45 var start = new Date().getTime();
46 setInterval(function() {
47 - React.renderComponent(
47 + React.render(
48 <ExampleApplication elapsed={new Date().getTime() - start} />,
49 document.getElementById('container')
50 );
examples/basic/index.html
+2 -2
@@ -39,12 +39,12 @@
39 }
40 });
41
42 - // Call React.createFactory instead of directly call ExampleApplication({...}) in React.renderComponent
42 + // Call React.createFactory instead of directly call ExampleApplication({...}) in React.render
43 var ExampleApplicationFactory = React.createFactory(ExampleApplication);
44
45 var start = new Date().getTime();
46 setInterval(function() {
47 - React.renderComponent(
47 + React.render(
48 ExampleApplicationFactory({elapsed: new Date().getTime() - start}),
49 document.getElementById('container')
50 );
examples/jquery-bootstrap/js/app.js
+1 -1
@@ -125,4 +125,4 @@ var Example = React.createClass({
125 }
126 });
127
128 -React.renderComponent(<Example />, document.getElementById('jqueryexample'));
128 +React.render(<Example />, document.getElementById('jqueryexample'));
examples/jquery-mobile/js/app.js
+1 -1
@@ -175,4 +175,4 @@ var PagePopUpContent = React.createClass({
175 });
176
177 // Render application.
178 -React.renderComponent(App(null), document.getElementById('content'));
178 +React.render(App(null), document.getElementById('content'));
examples/transitions/index.html
+1 -1
@@ -75,7 +75,7 @@
75 }
76 });
77
78 - React.renderComponent(
78 + React.render(
79 <AnimateDemo />,
80 document.getElementById('container')
81 );
perf/index.html
+1 -1
@@ -42,7 +42,7 @@ var reactVersions = [
42 window.onload = function(){
43 window.isDone = false;
44
45 - React.renderComponent(
45 + React.render(
46 BrowserPerfRunnerApp({
47 headless: perfRunner.getQueryParamArrayOrDefault('headless', [false])[0],
48 react: perfRunner.getQueryParamArrayOrDefault('react', reactVersions),
perf/lib/BrowserPerfRunnerContext.react.js
+12 -12
@@ -7,38 +7,38 @@ var BenchmarkQueue = React.createClass({
7 onCompleteEach: React.PropTypes.func,
8 onError: React.PropTypes.func
9 },
10 -
10 +
11 getDefaultProps: function(){
12 return {
13 maxTime: 5
14 };
15 },
16 -
16 +
17 getInitialState: function(){
18 return {
19 queue: this.props.initialQueue.slice()
20 };
21 },
22 -
22 +
23 setItemState: function(state){
24 state.test = this.state.queue[0].test;
25 state.react = this.state.queue[0].react;
26 this.props.onChange(state);
27 },
28 -
28 +
29 handleContextReady: function(window){
30 var benchmark = window.Benchmark(window.exports);
31 benchmark.options.maxTime = this.props.maxTime; //DEBUG
32
33 var itemState = {
34 testRunnerURL: window.location.href,
35 -
35 +
36 name: window.exports.name,
37 platform: window.Benchmark.platform.description,
38 reactVersion: window.React.version,
39 -
39 +
40 isMinified: (function(){
41 - var code = window.React.renderComponent.toString();
41 + var code = window.React.render.toString();
42 return code.indexOf(',') - code.indexOf('(') <= 2;
43 }())
44 };
@@ -66,11 +66,11 @@ var BenchmarkQueue = React.createClass({
66 });
67 benchmark.run({async:true});
68 },
69 -
69 +
70 shouldComponentUpdate: function(nextProps, nextState){
71 return nextState.queue.length < this.state.queue.length;
72 },
73 -
73 +
74 render: function(){
75 if (!(this.state.queue && this.state.queue.length > 0)){
76 return React.DOM.div({style:{display:'none'}});
@@ -110,11 +110,11 @@ var BrowserPerfRunnerContext = React.createClass({
110 // _handleFrameError: function(error){
111 // console.error('BrowserPerfRunnerContext', error);
112 // },
113 - //
113 + //
114 // _handleFrameLoad: function(event){
115 // console.log('BrowserPerfRunnerContext', event);
116 // },
117 - //
117 + //
118 _handleMessage: function(event){
119 if (location.href.indexOf(event.origin) !== 0)
120 return console.debug('BrowserPerfRunnerContext#_handleMessage ignored message from ' + event.origin);
@@ -191,5 +191,5 @@ var BrowserPerfRunnerContext = React.createClass({
191 right: '100%',
192 bottom: '100%'
193 }
194 -
194 +
195 });
perf/lib/todolist.html
+1 -1
@@ -10,7 +10,7 @@
10 <script>
11 function main(){
12 var app = todolist.App({ fakeDataCount:333 });
13 - React.renderComponent(app, document.body);
13 + React.render(app, document.body);
14 }
15 window.onload = main;
16 </script>
perf/tests/basic-unmount.js
+1 -1
@@ -15,7 +15,7 @@ exports.setup = function(){
15 /*global*/_rootNode = document.createElement('div');
16 document.body.appendChild(_rootNode);
17 var _firstChild = React.DOM.div(null, 'lol, perf testing ', this.count);
18 - React.renderComponent(_firstChild, _rootNode);
18 + React.render(_firstChild, _rootNode);
19 };
20 exports.fn = function(){
21 if (React.unmountAndReleaseReactRootNode) React.unmountAndReleaseReactRootNode(_rootNode);
perf/tests/propTypes.js
+1 -1
@@ -70,7 +70,7 @@ exports.fn = function(){
70 }));
71 };
72
73 - React.renderComponent(List({
73 + React.render(List({
74 array: [11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
75 bool: false,
76 number: Math.random(),
perf/tests/renderComponent-basic.js
+2 -2
@@ -9,14 +9,14 @@ if (typeof exports == 'undefined') exports = {};
9
10 /*http://benchmarkjs.com/docs#options*/
11
12 -exports.name = 'React.renderComponent single div';
12 +exports.name = 'React.render single div';
13
14 exports.setup = function(){
15 /*global*/_rootNode = document.createElement('div');
16 document.body.appendChild(_rootNode);
17 };
18 exports.fn = function(){
19 - React.renderComponent(React.DOM.div(null, 'lol, perf testing ', this.count), _rootNode);
19 + React.render(React.DOM.div(null, 'lol, perf testing ', this.count), _rootNode);
20 };
21 exports.teardown = function(){
22 if (React.unmountAndReleaseReactRootNode) React.unmountAndReleaseReactRootNode(_rootNode);
perf/tests/setState-callback-5.js
+1 -1
@@ -21,7 +21,7 @@ exports.setup = function(){
21 }
22 });
23
24 - React.renderComponent(AwesomeComponent(null), _rootNode);
24 + React.render(AwesomeComponent(null), _rootNode);
25 };
26 exports.fn = function(deferred){
27 setState({random: Date.now() + Math.random()}, function(){
perf/tests/setState-callback.js
+1 -1
@@ -21,7 +21,7 @@ exports.setup = function(){
21 }
22 });
23
24 - React.renderComponent(AwesomeComponent(null), _rootNode);
24 + React.render(AwesomeComponent(null), _rootNode);
25 };
26 exports.fn = function(deferred){
27 setState({random: Date.now() + Math.random()}, function(){
perf/tests/shouldComponentUpdate.js
+1 -1
@@ -18,7 +18,7 @@ exports.setup = function(){
18 document.body.appendChild(_rootNode);
19 };
20 exports.fn = function(){
21 - React.renderComponent(AwesomeComponent(null), _rootNode);
21 + React.render(AwesomeComponent(null), _rootNode);
22 };
23 exports.teardown = function(){
24 React.unmountComponentAtNode(_rootNode);
perf/tests/todolist-add.js
+1 -1
@@ -10,7 +10,7 @@ exports.setup = function(){
10 /*global*/_rootNode = document.createElement('div');
11 document.body.appendChild(_rootNode);
12 var appDescriptor = todolist.App({ fakeDataCount: 333 });
13 - /*global*/_app = React.renderComponent(appDescriptor, _rootNode);
13 + /*global*/_app = React.render(appDescriptor, _rootNode);
14 };
15 exports.fn = function(deferred){
16 var liCount = document.getElementsByTagName('li').length;
perf/tests/todolist-do-stuff.js
+1 -1
@@ -12,7 +12,7 @@ exports.setup = function(){
12 /*global*/_rootNode = document.createElement('div');
13 document.body.appendChild(_rootNode);
14 var appDescriptor = todolist.App({ fakeDataCount: 333 });
15 - /*global*/_app = React.renderComponent(appDescriptor, _rootNode);
15 + /*global*/_app = React.render(appDescriptor, _rootNode);
16 };
17
18 exports.fn = function(deferred){
perf/tests/todolist-edit.js
+1 -1
@@ -10,7 +10,7 @@ exports.setup = function(){
10 /*global*/_rootNode = document.createElement('div');
11 document.body.appendChild(_rootNode);
12 var appDescriptor = todolist.App({ fakeDataCount: 333 });
13 - /*global*/_app = React.renderComponent(appDescriptor, _rootNode);
13 + /*global*/_app = React.render(appDescriptor, _rootNode);
14 /*global*/_todo1 = _app.addItem("Howdy 1!");
15 /*global*/_todo2 = _app.addItem("Howdy 2!");
16 /*global*/_todo3 = _app.addItem("Howdy 3!");
perf/tests/todolist-mount.js
+1 -1
@@ -13,7 +13,7 @@ exports.setup = function(){
13 };
14
15 exports.fn = function(deferred){
16 - React.renderComponent(todolist.App({ fakeDataCount: 333 }), _rootNode, function(){ deferred.resolve(); });
16 + React.render(todolist.App({ fakeDataCount: 333 }), _rootNode, function(){ deferred.resolve(); });
17 };
18
19 exports.teardown = function(){