jacekschae / learn-re-frame-course-files

:cinema: Learn re-frame course files for building Cheffy app
https://www.learnreframe.com/
57 stars 43 forks source link

increment 8 - "Every element in a seq should have a unique :key" #4

Closed jtlocsei closed 5 years ago

jtlocsei commented 5 years ago

When I run increment 8 I get the console warning

Warning: Every element in a seq should have a unique :key: ([app.nav.views.nav_item.nav_item_reagentRender {:id :saved, :name "Saved", :href "#saved"}] [app.nav.views.nav_item.nav_item_reagentRender {:id :recipes, :name "Recipes", :href "#recipes"}] [app.nav.views.nav_item.nav_item_reagentRender {:id :inbox, :name "Inbox", :href "#inbox"}] [app.nav.views.nav_item.nav_item_reagentRender {:id :become-a-chef, :name "Chef", :href "#become-a-chef"}] [app.nav.views.nav_item.nav_item_reagentRender {:id :profile, :name "Profile", :href "#profile"}])
 (in app.core.app >  >  >  > app.nav.views.nav.nav > app.nav.views.authenticated.authenticated)

Is this fixed in a later increment? I'm confused because it looks like the nav-item function is setting a unique key on each element.

jacekschae commented 5 years ago

Hi there, Yep, it's fixed in the following videos.

In general setting unique id will have to be don with :key property - either with meta-data notation

^{:key "uid"}

or in a map

{:key "uid"
  ...}

Hope that helps

jtlocsei commented 5 years ago

Great, thanks Jacek!