-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Mapping key has multiple children #128
Comments
ballyalley-o
added a commit
that referenced
this issue
Apr 15, 2024
…r use-snack.tsx to import React and update AnimatePresence usage):
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
It seems like you're encountering a warning related to React, specifically about non-unique keys within components. In React, when rendering a list of elements, each element should have a unique "key" prop assigned to it. This allows React to efficiently update and manage the list.
The warning you're seeing indicates that you have two children within a component that share the same key, which can lead to unexpected behavior such as duplicated or omitted elements.
To resolve this warning, ensure that each child element within the component has a unique key prop assigned to it. You can use unique identifiers such as database IDs or index values if no other unique identifier is available. This ensures React can properly reconcile and update the list elements.
potential fix:
In this example, assuming each item in the items array has a unique id, we're using item.id as the key prop to ensure uniqueness. Make sure to replace item.id with the actual unique identifier in your code.
To Reproduce
Steps to reproduce the behavior:
Important
Error is comming from AnimateProsence from framer-motion, due to the children it is wrapping, solution is to map its children.
Solution
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: