Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/utils/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ function mapSingleChildIntoContext(traverseContext, child, name, i) {
var mapResult = mapBookKeeping.mapResult;

var keyUnique = !mapResult.hasOwnProperty(name);
warning(
keyUnique,
'ReactChildren.map(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
);
if (__DEV__) {
warning(
keyUnique,
'ReactChildren.map(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
);
}

if (keyUnique) {
var mappedChild =
Expand Down
16 changes: 9 additions & 7 deletions src/utils/flattenChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = !result.hasOwnProperty(name);
warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
);
if (__DEV__) {
warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
);
}
if (keyUnique && child != null) {
result[name] = child;
}
Expand Down