Skip to content

Commit ac84652

Browse files
committed
Cleanup console.* uses
* Stop doing `global.console && ...` * Make sure all uses are behind `__DEV__` checks so they get stripped out
1 parent eee3980 commit ac84652

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/core/ReactCompositeComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ var ReactCompositeComponent = {
902902
*/
903903
autoBind: function(method) {
904904
if (__DEV__) {
905-
console.warn && console.warn(
905+
console.warn(
906906
'React.autoBind() is now deprecated. All React component methods ' +
907907
'are auto bound by default, so React.autoBind() is a no-op. It ' +
908908
'will be removed in the next version of React'

src/core/ReactInstanceHandles.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,13 @@ var ReactInstanceHandles = {
320320
}
321321
}
322322

323-
global.console && console.error && console.error(
324-
'Error while invoking `findComponentRoot` with the following ' +
325-
'ancestor node:',
326-
ancestorNode
327-
);
323+
if (__DEV__) {
324+
console.error(
325+
'Error while invoking `findComponentRoot` with the following ' +
326+
'ancestor node:',
327+
ancestorNode
328+
);
329+
}
328330
invariant(
329331
false,
330332
'findComponentRoot(..., %s): Unable to find element. This probably ' +

src/dom/components/ReactDOMTextarea.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
5353
// TODO (yungsters): Remove support for children content in <textarea>.
5454
var children = this.props.children;
5555
if (children != null) {
56-
console.warn(
57-
'Use the `defaultValue` or `value` props instead of setting children ' +
58-
'on <textarea>.'
59-
);
56+
if (__DEV__) {
57+
console.warn(
58+
'Use the `defaultValue` or `value` props instead of setting ' +
59+
'children on <textarea>.'
60+
);
61+
}
6062
invariant(
6163
defaultValue == null,
6264
'If you supply `defaultValue` on a <textarea>, do not pass children.'

0 commit comments

Comments
 (0)