Skip to content

React throws unique "key" prop warning when using multiple tags like <div> inside <AIWriter> #2

Description

@malaccan

AIWriter works awesome, but it gives the warning below when i use multiple tags like this:

This is a test
Another line

[Error] Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.

Activity

007AnupamSharma commented on May 10, 2023

@007AnupamSharma

you should add a unique key or id to every div when you are rendering your div

malaccan commented on May 25, 2023

@malaccan
Author

even with the keys added, react gives the same warning error.
it can be reproduced with this example:

<AIWriter>
    <div key="1">some word</div>
    <div key="2">more text</div>
</AIWriter>

produces error:

[Error] Warning: Each child in a list should have a unique "key" prop.
See https://reactjs.org/link/warning-keys for more information.

the error goes away only if there is a single <div> component within the <AIWriter> block. however, AIWriter does not process <br/> for line breaks, so trying to replace multiple <div> with <br/> doesn't work as well.

thanks

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions