cljsrn

joshmiller 2022-06-01T23:00:18.000199Z

☝️ This is now on NPM, so you can use --template react-native-template-cljs-krell-storybook

joshmiller 2022-06-01T04:01:16.996779Z

I put together a template for RN with a working CLJS, Krell, and Storybook environment, including requiring local JS components: https://github.com/joshuamiller/react-native-template-cljs-krell-storybook

👏 7
joshmiller 2022-06-01T04:01:48.341099Z

It’s a one-liner to get it all installed: npx react-native init YourProjectName --template

joshmiller 2022-06-01T04:02:10.808679Z

I still need to touch up the README, but anyone who’s been working on this who wants to poke around before I publicize it, please feel free

loganrios 2022-06-04T05:51:07.238419Z

Very excited about this! I may deprecate my own cljsrn repo and migrate to using this template for my production work. Out of curiosity, how hard do you figure it would be to integrate the template with Expo? I’m not sure if it’s worth the time investment to try and get Expo’s tooling before I actually have to start writing an actual app 😅

mccraigmccraig 2022-06-09T09:30:41.853799Z

been looking with great interest at this approach @joshmiller... but how do people generally manage datastructures across the cljs/js divide - e.g. looking at the http://vouch.io vids, cljs datastructures are passed directly to UI components like ui/dashboard - but those components are vanilla js components developed with storybook - so how are they working with the cljs datastructures ?

joshmiller 2022-06-09T15:30:37.391079Z

@mccraigmccraig I’m not sure in the Vouch videos exactly how they’re doing it, but the way I handle it is to use reagent.adapt-react-class (which will automatically convert a map of args to JS props) and if necessary a thin wrapper.

joshmiller 2022-06-09T15:32:02.251229Z

So if you have a JS User component that takes props like { firstName:, email: }:

(def user (r/adapt-react-class User))
...
[user {:first-name "Name" :email ""}]

joshmiller 2022-06-09T15:33:13.288649Z

If I need to do more processing than that, I would make a thin Clojure component that just handles the data conversion then passes the bare data along.

mccraigmccraig 2022-06-09T16:01:40.319139Z

ah, ok - i've not used adapt-react-class before... that looks like it does a deep conversion, so should also work fine with component nesting

joshmiller 2022-06-04T18:43:05.644639Z

I've never actually tried Expo, so I'm not sure. I don't think there's any particular conflicts, except for possibly Expo having its own template.