Fork me on GitHub

Until now, I've used this recipe for each JS component:

(defn adapt-class [class]
  (when class
    (r/adapt-react-class class)))

(defn get-class [module name]
  (adapt-class (oops/oget+ module name)))

(defonce native-calendar (js/require "react-native-calendars"))
(def Calendar   (get-class native-calendar "Calendar"))
But, some components are different, and require accessing the component by "default", rather than its name, e.g.:
(defonce native-calendar-strip (js/require "react-native-calendar-strip"))
(def CalendarStrip (get-class native-calendar-strip "default"))
What is this default key, which is not mentioned in the component doc? Does JavaScript somehow try it automatically? Does this pattern occur often?


@deg the default is the javascript export way for this lib. Look at the source and you will see it


Thanks! Guess I've got to learn more es6 stuff! I plan to put together a tiny library that handles this stuff, once I have a bit more under my belt. It looks like most of the cljsrn projects I find online are duplicating tiny variations of the same things.


Happy to work on that library once you start it


Great! I'll announce here when I start. I hope sometime next week. (Ping me then, too, if this has scrolled off Slack's history).


@U7V9HE682 I've started. Very little so far: just a skeleton and one macro. Way too early to announce anything. But I'd love to accept PRs if you have good stuff to contribute.


Great! What are your main objectives for a first release?


I want to go through some of the existing projects on github, see what else other folks have done, and include whatever looks good. At the very least, loading components, managing styles, and console debug support. I want to do some cleanups... document what there is, and use best practices (e.g., almost everyone is improperly using aget on object properties). I want to get a little further on my toy project that uses this, and see what it needs.


What do you want to have and/or to do?


Will this be just for react-native or react and es6 in general


For now, just react-native. But, it's one of a family of mini-libraries I'm doing and others are for re-frame, so I'm not opposed to adding more; just maybe in separate libraries.