Skip to content

How to avoid React warning-keys? #2036

Answered by vicary
toiroakr asked this question in Q&A
Discussion options

You must be logged in to vote

GQty renders a first time with undefined to capture your GraphQL selections before fetching, assuming no sane person would use 0 as an id you may always to this:

<div>
  {query.allFirms()?.films?.map((film) => (
-   <div key={film?.id}>
+   <div key={film?.id ?? 0}>
    </div>
  )}
</div>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@toiroakr
Comment options

Answer selected by toiroakr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants