Find callsites that would call toString() if we pass attributes through (#10416)
* Find callsites that would call toString() if we pass attributes through * Warn for all object unknown props, not just 'toString' ones fixing this as per Sebastian's feedback, because we want to find all objects and not just ones with 'toString' defined. Because there may be other corner cases and issues that are revealed.
Dan Abramov committed
Aug 11, 2017 at 20:07 UTC
58e6edeef61f5ab5b81530820571213161940d6a
1 file changed
+12
src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
+12
@@ -126,6 +126,18 @@ var warnUnknownProperties = function(type, props, debugID) {
126
var isValid = validateProperty(type, key, debugID);
127
if (!isValid) {
128
unknownProps.push(key);
129
+ var value = props[key];
130
+ if (typeof value === 'object' && value !== null) {
131
+ warning(
132
+ false,
133
+ 'The %s prop on <%s> is not a known property, and was given an object.' +
134
+ 'Remove it, or it will appear in the ' +
135
+ 'DOM after a future React update.%s',
136
+ key,
137
+ type,
138
+ getStackAddendum(debugID),
139
+ );
140
+ }
141
}
142
}
143