Skip to content

React.Children.map(children, (child, index) => but got child.type.name is undefined on IE browser #9803

Description

@SimonCheung1989

as title, i want to get child element's tag name,

    ```
    const { children, theme } = this.props;
    const { open } = this.state;

    let summary = null;
    const otherChildren = [];
    React.Children.map(children, (child, index) => {
        if (child.type) {
            console.log(`child type.name: ${child.type.name} `);
        }
        if (child.type && child.type.name === 'Summary') {
            summary = cloneElement(child, {
                children: child.props.children,
                handleClick: this.handleClick,
                handleKeyPress: this.handleKeyPress,
                theme: child.props.theme
            });
        } else {
            otherChildren.push(child);
        }
    });
**Success in Chrome browser**

![image](https://cloud.githubusercontent.com/assets/12840387/26545546/91d55f64-4498-11e7-8dfd-ebd4f383b0c0.png)

**Failed in IE browser**

![image](https://cloud.githubusercontent.com/assets/12840387/26545680/1c07cd48-4499-11e7-9a5e-ffe19013e6fa.png)



Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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