Fork me on GitHub
#clojurescript
<
2020-09-30
>
Andreas S.11:09:39

I'm going through the reagent tutorial

Andreas S.11:09:24

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?

kimim13:09:24

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.

Aron14:09:38

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?

d._.b19:09:06

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))]

d._.b19:09:32

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?

p-himik20:09:25

doall returns a seq and mapv returns a vector.

p-himik20:09:37

To avoid having to use into with outer components, you can create a fragment by putting everything into [:<>]:

(into [:<>] (map-indexed ...) children)

p-himik20:09:49

By the way, don't use index as :key.

p-himik20:09:31

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.

d._.b22:09:58

Why is that (RE: idx as key)?

d._.b22:09:01

Should it be a UUID?