Skip to content

The returned value of React.Children.map is weird. #4410

@benjycui

Description

@benjycui

I am not sure whether it is a bug. Let's look at the following code(or in JSFiddle):

var Test = React.createClass({
    render: function() {
        console.log(React.Children.map(this.props.children, function(child) {
            return child;
        }));
        // console.log(this.props.children);
        return this.props.children;
    }
});

React.render(
React.createElement(Test, {}, React.createElement('input', {})), document.body)

I think the returned value of React.Children.map should be the same as this.props.children. But what surprise me is that the returned value is something like this: {'.0': ReactElement}.

Do I misunderstand React.Children.map?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions