Skip to content

key="0" attribute on root element disrupts rendering #113

Open
@kromit

Description

@kromit

When processing multiple HTML chunks <p>mytext-1</p>, <p>mytext-2</p>, <p>mytext-3</p>
the parser generates key="0" attribute every time.

<div>
  {parser.parse('<p>mytext-1</p>`')}
  {parser.parse('<p>mytext-2</p>`')}
  {parser.parse('<p>mytext-3</p>`')}
</div>

This causes react-warnings and disrupts rendering since the children can not be distinguished from each other with same key="0" attribute.

key="0" on root element should not be rendered at all.

react warning:

Warning: Encountered two children with the same key, 0. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

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