You should statt shadow-cljs to watch your app [shadow-cljs watch app]
This will start a nrepl
And in Emacs you could cider-connect-cljs
To the given port.
Hello! I’m having problems to understand what’s the actual transformation that a Reagent component does to the props when it passes them down to the actual React component. I have a JS object that I get from a third-party library, and I’m applying `js->clj` to it in order to make some transformations and later pass it to a Reagent component. For this transformations, I would prefer to deal with keywords instead of strings, but if I apply `js->clj` with `:keywordize-keys true`, the Reagent component later doesn’t behave the same way. I thought Reagent wouldn’t care if the keys are keywordized or not!
Apart from some other things, Reagent turns keys like :a-b
into "aB"
. Reagent's conversion is different from js->clj
.
This is the function that converts props: https://github.com/reagent-project/reagent/blob/d1ae601d8da2391eedfdf7df4e9842048f20ec45/src/reagent/impl/template.cljs#L118
that was useful, thanks - so it seems that in a scenario like the one I’m describing, it’s not a good practice to do a js->clj
transformation if that object is going to be eventually passed down to a Reagent component, and probably it’s better to deal with the js object directly using something like applied-science.js-interop
, right?
Yep, or https://google.github.io/closure-library/api/goog.object.html or https://github.com/mfikes/cljs-bean or https://github.com/binaryage/cljs-oops
Or, if you use shadow-cljs, you can use the regular way to get/set properties via interop if you specify that the type of the object is js
:
(.-myProp ^js obj)
makes sense, thanks
I’ll probably come back here at some point in the future as I’m still learning about all this and I need some time to play with things