I copied two years ago from here . He currently works with Figwheel and uses a newer version of Reagent / React. I am looking for a general way to isolate this warning message that comes to the Javascript console: Warning: Every element in a seq should have a unique :key . The idea is to put :key with a unique value generated in all components. Then the messages should disappear, and I will be able to see which components need a unique :key . My problem is that even though they all enter a unique :key , a warning message is still visible.
So - can anyone tell me which component I missed, or else what I did wrong? As you can see from source (permalink) , I added :key (gen-key) to two components: [:polyline {:key (gen-key) ... and [:svg {:key (gen-key) ... on lines 43 and 68, respectively.
Edit So this is answer (permalink) in terms of code. Just find the location ^{:key (gen-key)} on lines 44 and 60.
Note that the gen-key function was created for debugging. Natural keys for replacement.
Here is how you could implement gen-key :
(defn gen-key [] (gensym "key-"))
And here is the path made in the links above:
(def uniqkey (atom 0)) (defn gen-key [] (let [res (swap! uniqkey inc)] (u/log res) res))
source share