Fork me on GitHub
#helix
<
2020-06-16
>
dominicm14:06:56

I feel like I asked this before, when I want to pass js object props to a component when using $, how do I do that? Is {:& (theProps)} my only option? It feels inefficient.

lilactown14:06:03

yeah, {:& whatever-props}

dominicm15:06:41

Oh, you actually optimize this case. By checking for (seq m) and just returning it if so, nice.

dominicm15:06:03

ah, but native props is runtime :thinking_face:

dominicm15:06:25

Oh, everything goes through it, so all good

dominicm15:06:04

I wish I had a recursive #js sometimes, I wrote one once.

lilactown15:06:28

Really I wish that maps compiled to #js if they’re never assoced 😝

dominicm15:06:13

I can't even imagine the analysis on that...

dominicm15:06:43

My colleague has expressed similar wishes though, except that everything was #js by default… I didn't like that as much because mutability.

dominicm15:06:28

I did just discover that the appliedscience js-interop library has j/lit for this use-case, but I'm trying to reduce my dependence on that. I think cljs-bean & goog.object are better/good enough, respectively.

lilactown15:06:35

or even if JS objects implemented assoc / get / etc. and just did copy-on-write

lilactown15:06:30

i’m not sure how safe that would be tho since there’s a lot of objects out there that you might not want those semantics 😛

lilactown15:06:48

the conflation of data literal === object is annoying in this case

Eliraz15:06:15

does anyone here has an experience with reitit ? is it worth the try?

dominicm15:06:49

@lilactown also, the new proxies feature would be a real thorn in that. Imagine doing a get on an object and it starts doing stuff.

lilactown15:06:22

well that’s already possible in CLJS 😛 since get is just a protocol, anyone can do anything in it!

dominicm16:06:16

There is examples of doing that, though dnolen has discouraged for reasons I forget

lilactown16:06:07

would be fun to play with a mobx-like reactive interface where get is what attaches listeners and assoc triggers downstream changes