Fork me on GitHub

You cannot have both a cljs and a cljc file for the same namespace, right?

Alex Miller (Clojure team)18:12:24

If you have both, the cljs one will be used

👍 4

Clojurescript will use the cljc one for macros too


ClojureScript will use both the cljs and the clic one if they both exist for the same namespace, e.g. both source files in same directory, and both with same name except the suffix?


Not really. When loading a runtime namespace, according to the loading rules, .cljs will be preferred over .cljc . When loading a macros namespace .clj will be preferred over .cljc.


Quick question: I'm getting a javascript object back (from react-native) that I passed in before as a cljs map (from a re-frame subscription). It's a nested something of maps and lists. Is there any way to get the original cljs datastructure back? I tried js->clj, but pretty much everything is broken afterwards (keyword tuned into strings, even if I use keywordize: true). I need to access the data using heavy desctructuring. Is there a better way to handle this problem? I'm using shadow cljs, maybe it offers something here?


Most likely, it's just Reagent since it's built on top of React. And React is purely JS, so it wants JS objects. If you don't need to access that CLJS map from some JS component, you can just wrap it into some object that is opaque for the clj->js function. More details and some workarounds: