Skip to content

Issue with multiple children #9

@grxy

Description

@grxy

I ran into the following problem where not all nested children would be visited:

This works

const A = ({ children }) => children
const B = ({ children }) => <div>{children}</div>

const tree = (
    <A>
        <B />
        <B />
    </A>
)

reactTreeWalker(tree, visitor, context)

So does this

const A = ({ children }) => <div>{children}</div>
const B = ({ children }) => children

const tree = (
    <A>
        <B />
        <B />
    </A>
)

reactTreeWalker(tree, visitor, context)

This does not work

Because there are no basic HTML elements wrapping the children of A, those individual children are not visited

const A = ({ children }) => children
const B = ({ children }) => children

const tree = (
    <A>
        <B />
        <B />
    </A>
)

reactTreeWalker(tree, visitor, context)

A PR will follow shortly and should provide a fix for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions