Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Fix key warning #10

Merged
merged 3 commits into from
Jan 19, 2016
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions lib/process-node-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function createStyleJsonFromString(styleString) {
}

var ProcessNodeDefinitions = function(React) {
var index = 0;

function processDefaultNode(node, children) {
if (node.type === 'text') {
return node.data;
Expand Down Expand Up @@ -47,6 +49,8 @@ var ProcessNodeDefinitions = function(React) {
});
}

elementProps.key = ++index;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lithin, since the key property is always set, do you mind moving this up to where elementProps is defined? So that it will look like this:

var elementProps = {
    key: ++index
};

Thanks,

Mike


return React.createElement(node.name, elementProps, node.data, children);
}

Expand Down