The library for web and native user interfaces.
Cleanup console.* uses
* Stop doing `global.console && ...` * Make sure all uses are behind `__DEV__` checks so they get stripped out
Paul O'Shannessy committed
Jul 12, 2013 at 15:40 UTC
ac84652e50e3a461e5f7efeb17388df5105b7cb8
3 files changed
+14
-10
src/core/ReactCompositeComponent.js
+1
-1
@@ -902,7 +902,7 @@ var ReactCompositeComponent = {
902
*/
903
autoBind: function(method) {
904
if (__DEV__) {
905
- console.warn && console.warn(
905
+ console.warn(
906
'React.autoBind() is now deprecated. All React component methods ' +
907
'are auto bound by default, so React.autoBind() is a no-op. It ' +
908
'will be removed in the next version of React'
src/core/ReactInstanceHandles.js
+7
-5
@@ -320,11 +320,13 @@ var ReactInstanceHandles = {
320
}
321
}
322
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
+ }
330
invariant(
331
false,
332
'findComponentRoot(..., %s): Unable to find element. This probably ' +
src/dom/components/ReactDOMTextarea.js
+6
-4
@@ -53,10 +53,12 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
53
// TODO (yungsters): Remove support for children content in <textarea>.
54
var children = this.props.children;
55
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
+ }
62
invariant(
63
defaultValue == null,
64
'If you supply `defaultValue` on a <textarea>, do not pass children.'