Skip to content

Conversation

@vitaliymaz
Copy link
Contributor

My previous PR #286 broke one rare case. I'm sorry for that.

The case is when a component renders elements inside nested arrays. Example:

<div>
          {[
            [
              <p key='1' styleName='foo' />,
              <p key='2' styleName='bar' />
            ],
            [
              <p key='1' styleName='foo' />,
              <p key='2' styleName='bar' />
            ]
          ]}
        </div>

It worked before my PR because React.Children.map() recursively walks through nested arrays but lodash map doesn't do that. From another point of view, React.Children.map() flattens the array and changes the original structure.

The best solution I found is already existing function of your library called linkArray(). It also walks through arrays but unlike the React.Children.map() doesn't change the structure.

Again, I'm sorry for this regression bug.

@gajus gajus merged commit 7a87ee3 into gajus:master Aug 22, 2018
@vitaliymaz vitaliymaz deleted the fix-assign-class-in-nested-arrays branch August 22, 2018 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants