Skip to content

[4.0.0.rc-9] Immutable renders a Map's key in React 16 #1430

Closed
@athomann

Description

@athomann

What happened

Updated a Repo to React 16 and discovered that iterating over a Map will render the return item && the key. I realize using Maps as children is experimental but thought you'd like to know. Not sure if this would be considered a react 16 bug.

What I expected:
Render the React element and ignore the key.

How to reproduce

type ItemMap = Map<*, *>;
const itemMap: ItemMap = Map({
  0: 'zero',
  1: 'one',
  2: 'two',
});

{itemMap.map((item, index) => (
  <Item key={index} item={item} />
)}

will render something like 0 <Item /> 1 <Item /> 3 <Item />

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