Fork me on GitHub
#reagent
<
2020-08-29
>
David Pham06:08:41

You should statt shadow-cljs to watch your app [shadow-cljs watch app]

David Pham06:08:48

This will start a nrepl

David Pham06:08:08

And in Emacs you could cider-connect-cljs

David Pham06:08:17

To the given port.

dani15:08:37

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!

p-himik15:08:38

Apart from some other things, Reagent turns keys like :a-b into "aB". Reagent's conversion is different from js->clj.

dani16:08:17

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?

p-himik16:08:10

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)

dani16:08:47

makes sense, thanks

dani16:08:27

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