Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

React warning for key in jt #166

Open
AlexMost opened this issue May 21, 2019 · 1 comment
Open

React warning for key in jt #166

AlexMost opened this issue May 21, 2019 · 1 comment
Assignees
Milestone

Comments

@AlexMost
Copy link
Member

AlexMost commented May 21, 2019

Example:

const el = <br/>;
const = jt`text ${el} text`

React will warn that br should have a unique key.

Possible solutions:

  1. Add keys if not exist for nested elements.
  2. Wrap jt content in the <React.Fragment/>
@AlexMost AlexMost self-assigned this May 21, 2019
@AlexMost AlexMost added this to the 1.8.0 Release milestone May 21, 2019
@dimaqq
Copy link

dimaqq commented Jul 26, 2019

IMO fragment makes most sense because the number of elements is constant.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants