Fork me on GitHub
#rum
<
2020-07-08
>
sova-soars-the-sora13:07:30

Hi, is it smarter to put every component that has a serverside/clientside definition in a .cljc?

sova-soars-the-sora13:07:01

I have been keeping them separately, cljs and clj but that can become perniciously detail-oriented

Roman Liutikov14:07:07

Yes, I'd put them into cljc

Roman Liutikov14:07:36

and have one component definition with reader conditionals, if needed, in the body of a component

Roman Liutikov14:07:22

(rum/defc component []
  #?(:clj (do-in-clj)
     :cljs (do-in-cljs))
  [:h1 "hello"])

Roman Liutikov14:07:09

this way you'll have a single unit in a form of a component where you can always find clj and cljs parts of it