Skip to content
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

Problem with sibling children's keys #38

Closed
andromorv opened this issue Aug 21, 2015 · 1 comment
Closed

Problem with sibling children's keys #38

andromorv opened this issue Aug 21, 2015 · 1 comment

Comments

@andromorv
Copy link

Today i've updated rum to 0.3.0 version and this warning appears:

Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of pic-likes. See https://fb.me/react-warning-keys for more information.

My pic-likes component looks like:

(rum/defc pic-likes < rum/static
  [{:keys [likes] :as image} user]
  (let [likes-count (count likes)
        liked (contains? likes (:id user))]
    [:a {:class-name "pic-likes"
         :href "#like"
         :on-click #(do
                      (.preventDefault %)
                      (toggle-pic-like image user))}
     (pic-likes-counter likes-count)
     (icon {:class-name "pic-likes-icon"
            :icon (if liked "favorite" "favorite-outline")})]))

If I wrap both pic-counter and icon components with with-key function and give them different keys - problem disappears. But it's kind of strange, you can see I don't iterate over these blocks. They are just siblings.

@andromorv
Copy link
Author

Ok, it's duplicate of this #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant