reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
2020-08-29T06:56:41.024800Z

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

2020-08-29T06:56:48.025100Z

This will start a nrepl

2020-08-29T06:57:08.025800Z

And in Emacs you could cider-connect-cljs

2020-08-29T06:57:17.026100Z

To the given port.

dani 2020-08-29T15:45:37.026700Z

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-himik 2020-08-29T15:47:38.026800Z

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

dani 2020-08-29T16:16:17.027300Z

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-himik 2020-08-29T16:22:10.027900Z

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)

dani 2020-08-29T16:23:47.028100Z

makes sense, thanks

dani 2020-08-29T16:24:27.028300Z

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