clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Andreas S. 2020-09-30T11:39:30.183100Z

hi!

Andreas S. 2020-09-30T11:39:39.183400Z

I'm going through the reagent tutorial

Andreas S. 2020-09-30T11:40:24.184200Z

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?

2020-09-30T13:07:24.185900Z

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.

Aron 2020-09-30T14:57:38.188600Z

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._.b 2020-09-30T19:22:06.195200Z

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._.b 2020-09-30T19:24:32.196500Z

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-himik 2020-09-30T20:17:25.197500Z

doall returns a seq and mapv returns a vector.

p-himik 2020-09-30T20:18:37.197700Z

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

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

p-himik 2020-09-30T20:18:49.197900Z

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

p-himik 2020-09-30T20:19:31.198100Z

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._.b 2020-09-30T22:58:58.198600Z

Why is that (RE: idx as key)?

d._.b 2020-09-30T22:59:01.198800Z

Should it be a UUID?