hi!
I'm going through the reagent tutorial
https://github.com/reagent-project/reagent/tree/master/examples/simple if I invoke leinfighwheel that works but the command for the production build does not work, can someone please help me with this?
Hello, I'm using react-data-grid to show some data. But since version 7.0.0.canary.17 this lib uses some ES2020 feature, as it says: react-data-grid is published as ES2020 modules, you'll probably want to transpile those down to scripts for the browsers you target using https://babeljs.io/ and https://github.com/browserslist/browserslist. How can I enable this for cljs? Thanks.
I need to call googles gtag like here https://developers.google.com/gtagjs/reference/api#event What's a proper, neat or idiomatic or accepted way to do this such that if gtag is not there, it won't fail?
I'm a bit puzzled by something and could use some help.
I have a function with-key-meta
that decorates children with metadata, specifically {:key ...}
This function looks like this:
(defn with-key-meta [coll]
(doall (for [[id child] coll]
(with-meta child {:key id}))))
When called like this, it works:
[:div.foo (with-key-meta (map-indexed vector children))]
Why doesn't this work the same way?
[:div.foo (mapv (fn [[id child]]
(with-meta child {:key id}))
(map-indexed vector children))]
I can do (into [:div.foo] ...)
and make it work, but both of these things are persistent vectors. Why is the fn call treated differently than the inline expression?
doall
returns a seq and mapv
returns a vector.
To avoid having to use into
with outer components, you can create a fragment by putting everything into [:<>]
:
(into [:<>] (map-indexed ...) children)
By the way, don't use index as :key
.
If you don't really care about the :key
yourself and just want to fix that warning, then just don't use seqs and use vectors and fragments instead without any metadata.
Why is that (RE: idx as key)?
Should it be a UUID?