This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-09
Channels
- # announcements (5)
- # aws (5)
- # babashka (7)
- # beginners (152)
- # cider (10)
- # clj-kondo (30)
- # clj-on-windows (1)
- # cljs-dev (14)
- # cljsrn (19)
- # clojure (94)
- # clojure-australia (4)
- # clojure-europe (43)
- # clojure-nl (2)
- # clojure-uk (11)
- # clojurescript (16)
- # clojureverse-ops (5)
- # code-reviews (7)
- # community-development (6)
- # core-async (29)
- # cursive (50)
- # datomic (22)
- # docker (10)
- # figwheel-main (3)
- # fulcro (4)
- # graalvm (1)
- # introduce-yourself (2)
- # kaocha (9)
- # lambdaisland (2)
- # lsp (19)
- # malli (37)
- # off-topic (50)
- # polylith (8)
- # portal (1)
- # reagent (10)
- # rum (1)
- # shadow-cljs (24)
- # spacemacs (14)
- # yada (2)
hi guys, I got a question regarding the following (related to nested variadic-param children and the react :key thingy):
we came up with the convention to basically use form2 components with the following function signature
[props & children]
however, if I nest components more than once like that I get those 'react key' warnings in the browser
I think it is because of the variadic thingy ... the children ... end up like [[children]] if you catch my meaning, and actually I think those vectors become sequences somehow (because I tried to flatten the vector but couldn't - and the repl spits out a seq if I play around with it)
so even if I map-indexed
over the children in the last/base component it warns in the console bout missing :key props ...
only if I map-indexed
every time I'm passing on them children the console stays clear of warnings, but I don't want to do that if I basically pass on children to another component I know to receive them as just a param ... or should I??
because effectively only the very last component actually renders html, the others pass on children without renderin them, just like a param, right??
I am quite a beginner in clojure and honestly, I don't know what to do or if to change the [props & children]
convention or what the default/recommended way here is
With arbitrary children, just use into
:
(defn my-component [props & children]
(into [:div props]
children))
heyyyya!!!! that's working like a charm. in my case I add the props to some parent html tag in the component and the children are independent of those props, so I:
(into [:<>] children)
which works as well.
thx a whole lot!!!