Update warning messages to use ReactDOM and ReactDOMServer as appropriate
Fixes #4710. - `React.findDOMNode` => `ReactDOM.findDOMNode` - `React.render` => `ReactDOM.render` or "top-level render" (depends on whether we're in DOM-specific usage or generic cases) - `React.renderToString` => `ReactDOMServer.renderToString` - `React.renderToStaticMarkup` => `ReactDOMServer.renderToStaticMarkup`
Michelle Todd committed
Aug 31, 2015 at 22:55 UTC
719fe15b9ecf28271bbff8c281767abd2966550a
16 files changed
+25
-25
src/isomorphic/classic/class/ReactClass.js
+1
-1
@@ -61,7 +61,7 @@ function warnSetProps() {
61
warning(
62
false,
63
'setProps(...) and replaceProps(...) are deprecated. ' +
64
- 'Instead, call React.render again at the top level.'
64
+ 'Instead, call render again at the top level.'
65
);
66
}
67
}
src/isomorphic/classic/class/__tests__/ReactClass-test.js
+1
-1
@@ -381,7 +381,7 @@ describe('ReactClass-spec', function() {
381
expect(console.error.calls.length).toBe(1);
382
expect(console.error.calls[0].args[0]).toContain(
383
'MyComponent.getDOMNode(...) is deprecated. Please use ' +
384
- 'React.findDOMNode(instance) instead.'
384
+ 'ReactDOM.findDOMNode(instance) instead.'
385
);
386
});
387
src/isomorphic/classic/element/ReactElementValidator.js
+1
-1
@@ -93,7 +93,7 @@ function getAddendaForKeyUse(messageType, element, parentType) {
93
var parentName = typeof parentType === 'string' ?
94
parentType : parentType.displayName || parentType.name;
95
if (parentName) {
96
- addendum = ` Check the React.render call using <${parentName}>.`;
96
+ addendum = ` Check the top-level render call using <${parentName}>.`;
97
}
98
}
99
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
+1
-1
@@ -113,7 +113,7 @@ describe('ReactElementValidator', function() {
113
expect(console.error.argsForCall.length).toBe(1);
114
expect(console.error.argsForCall[0][0]).toBe(
115
'Warning: Each child in an array or iterator should have a unique ' +
116
- '"key" prop. Check the React.render call using <div>. See ' +
116
+ '"key" prop. Check the top-level render call using <div>. See ' +
117
'https://fb.me/react-warning-keys for more information.'
118
);
119
});
src/isomorphic/modern/class/ReactComponent.js
+3
-3
@@ -105,7 +105,7 @@ if (__DEV__) {
105
var deprecatedAPIs = {
106
getDOMNode: [
107
'getDOMNode',
108
- 'Use React.findDOMNode(component) instead.',
108
+ 'Use ReactDOM.findDOMNode(component) instead.',
109
],
110
isMounted: [
111
'isMounted',
@@ -114,7 +114,7 @@ if (__DEV__) {
114
],
115
replaceProps: [
116
'replaceProps',
117
- 'Instead, call React.render again at the top level.',
117
+ 'Instead, call render again at the top level.',
118
],
119
replaceState: [
120
'replaceState',
@@ -123,7 +123,7 @@ if (__DEV__) {
123
],
124
setProps: [
125
'setProps',
126
- 'Instead, call React.render again at the top level.',
126
+ 'Instead, call render again at the top level.',
127
],
128
};
129
var defineDeprecationWarning = function(methodName, info) {
src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
+1
-1
@@ -411,7 +411,7 @@ describe('ReactES6Class', function() {
411
expect(console.error.calls.length).toBe(5);
412
expect(console.error.calls[0].args[0]).toContain(
413
'getDOMNode(...) is deprecated in plain JavaScript React classes. ' +
414
- 'Use React.findDOMNode(component) instead.'
414
+ 'Use ReactDOM.findDOMNode(component) instead.'
415
);
416
expect(console.error.calls[1].args[0]).toContain(
417
'replaceState(...) is deprecated in plain JavaScript React classes'
src/renderers/dom/client/ReactMount.js
+2
-2
@@ -531,7 +531,7 @@ var ReactMount = {
531
_renderSubtreeIntoContainer: function(parentComponent, nextElement, container, callback) {
532
invariant(
533
ReactElement.isValidElement(nextElement),
534
- 'React.render(): Invalid component element.%s',
534
+ 'ReactDOM.render(): Invalid component element.%s',
535
(
536
typeof nextElement === 'string' ?
537
' Instead of passing an element string, make sure to instantiate ' +
@@ -982,7 +982,7 @@ var ReactMount = {
982
'You\'re trying to render a component to the document but ' +
983
'you didn\'t use server rendering. We can\'t do this ' +
984
'without using server rendering due to cross-browser quirks. ' +
985
- 'See React.renderToString() for server rendering.'
985
+ 'See ReactDOMServer.renderToString() for server rendering.'
986
);
987
988
if (transaction.useCreateElement) {
src/renderers/dom/client/__tests__/ReactMount-test.js
+2
-2
@@ -47,7 +47,7 @@ describe('ReactMount', function() {
47
expect(function() {
48
ReactTestUtils.renderIntoDocument('div');
49
}).toThrow(
50
- 'Invariant Violation: React.render(): Invalid component element. ' +
50
+ 'Invariant Violation: ReactDOM.render(): Invalid component element. ' +
51
'Instead of passing an element string, make sure to instantiate it ' +
52
'by passing it to React.createElement.'
53
);
@@ -62,7 +62,7 @@ describe('ReactMount', function() {
62
expect(function() {
63
ReactTestUtils.renderIntoDocument(Component);
64
}).toThrow(
65
- 'Invariant Violation: React.render(): Invalid component element. ' +
65
+ 'Invariant Violation: ReactDOM.render(): Invalid component element. ' +
66
'Instead of passing a component class, make sure to instantiate it ' +
67
'by passing it to React.createElement.'
68
);
src/renderers/dom/client/__tests__/ReactRenderDocument-test.js
+1
-1
@@ -244,7 +244,7 @@ describe('rendering React components at document', function() {
244
'Invariant Violation: You\'re trying to render a component to the ' +
245
'document but you didn\'t use server rendering. We can\'t do this ' +
246
'without using server rendering due to cross-browser quirks. See ' +
247
- 'React.renderToString() for server rendering.'
247
+ 'ReactDOMServer.renderToString() for server rendering.'
248
);
249
});
250
src/renderers/dom/shared/Danger.js
+3
-3
@@ -54,7 +54,7 @@ var Danger = {
54
'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
55
'thread. Make sure `window` and `document` are available globally ' +
56
'before requiring React when unit testing or use ' +
57
- 'React.renderToString for server rendering.'
57
+ 'ReactDOMServer.renderToString for server rendering.'
58
);
59
var nodeName;
60
var markupByNodeName = {};
@@ -161,7 +161,7 @@ var Danger = {
161
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
162
'worker thread. Make sure `window` and `document` are available ' +
163
'globally before requiring React when unit testing or use ' +
164
- 'React.renderToString for server rendering.'
164
+ 'ReactDOMServer.renderToString() for server rendering.'
165
);
166
invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.');
167
invariant(
@@ -169,7 +169,7 @@ var Danger = {
169
'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
170
'<html> node. This is because browser quirks make this unreliable ' +
171
'and/or slow. If you want to render to the root you must use ' +
172
- 'server rendering. See React.renderToString().'
172
+ 'server rendering. See ReactDOMServer.renderToString().'
173
);
174
175
var newChild;
src/renderers/dom/shared/ReactBrowserComponentMixin.js
+1
-1
@@ -30,7 +30,7 @@ var ReactBrowserComponentMixin = {
30
warning(
31
this.constructor[didWarnKey],
32
'%s.getDOMNode(...) is deprecated. Please use ' +
33
- 'React.findDOMNode(instance) instead.',
33
+ 'ReactDOM.findDOMNode(instance) instead.',
34
ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown'
35
);
36
this.constructor[didWarnKey] = true;
src/renderers/dom/shared/ReactDOMComponent.js
+2
-2
@@ -138,7 +138,7 @@ function legacySetProps(partialProps, callback) {
138
warning(
139
false,
140
'ReactDOMComponent: Do not access .setProps() of a DOM node. ' +
141
- 'Instead, call React.render again at the top level.%s',
141
+ 'Instead, call ReactDOM.render again at the top level.%s',
142
getDeclarationErrorAddendum(component)
143
);
144
}
@@ -157,7 +157,7 @@ function legacyReplaceProps(partialProps, callback) {
157
warning(
158
false,
159
'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' +
160
- 'Instead, call React.render again at the top level.%s',
160
+ 'Instead, call ReactDOM.render again at the top level.%s',
161
getDeclarationErrorAddendum(component)
162
);
163
}
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+2
-2
@@ -1019,11 +1019,11 @@ describe('ReactDOMComponent', function() {
1019
expect(console.error.calls.length).toBe(2);
1020
expect(console.error.calls[0].args[0]).toBe(
1021
'Warning: ReactDOMComponent: Do not access .setProps() of a DOM node. ' +
1022
- 'Instead, call React.render again at the top level.'
1022
+ 'Instead, call ReactDOM.render again at the top level.'
1023
);
1024
expect(console.error.calls[1].args[0]).toBe(
1025
'Warning: ReactDOMComponent: Do not access .replaceProps() of a DOM ' +
1026
- 'node. Instead, call React.render again at the top level.'
1026
+ 'node. Instead, call ReactDOM.render again at the top level.'
1027
);
1028
});
1029
src/renderers/shared/reconciler/ReactCompositeComponent.js
+2
-2
@@ -457,7 +457,7 @@ var ReactCompositeComponentMixin = {
457
}
458
if (error instanceof Error) {
459
// We may want to extend this logic for similar errors in
460
- // React.render calls, so I'm abstracting it away into
460
+ // top-level render calls, so I'm abstracting it away into
461
// a function to minimize refactoring in the future
462
var addendum = getDeclarationErrorAddendum(this);
463
@@ -822,7 +822,7 @@ var ReactCompositeComponentMixin = {
822
823
/**
824
* Get the publicly accessible representation of this component - i.e. what
825
- * is exposed by refs and returned by React.render. Can be null for stateless
825
+ * is exposed by refs and returned by render. Can be null for stateless
826
* components.
827
*
828
* @return {ReactComponent} the public component instance.
src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
+1
-1
@@ -284,7 +284,7 @@ describe('ReactComponent', function() {
284
expect(console.error.calls.length).toBe(1);
285
expect(console.error.calls[0].args[0]).toContain(
286
'Potato.getDOMNode(...) is deprecated. Please use ' +
287
- 'React.findDOMNode(instance) instead.'
287
+ 'ReactDOM.findDOMNode(instance) instead.'
288
);
289
});
290
src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js
+1
-1
@@ -230,7 +230,7 @@ describe('ReactEmptyComponent', function() {
230
expect(function() {
231
ReactDOM.render(null, div);
232
}).toThrow(
233
- 'Invariant Violation: React.render(): Invalid component element.'
233
+ 'Invariant Violation: ReactDOM.render(): Invalid component element.'
234
);
235
});
236