Fork me on GitHub
#rum
<
2017-01-08
>
martinklepsch08:01:06

Is there documentation somewheere how to use a regular react component with Rum?

martinklepsch08:01:22

(rum/defc flipmove [{:keys [children]}]
  (js/React.createElement js/FlipMove #js {:children (clj->js children)
                                           :easing "cubic-bezier(0, 0.7, 0.8, 0.1)"}))

martinklepsch08:01:26

not so hard after all

misha09:01:49

@martinklepsch I have this in my RN code:

(defn create-element [rn-comp opts & children]
  (apply js/React.createElement rn-comp (clj->js opts) children))

(def text (partial create-element (.-Text ReactNative)))

;then later inside some view:
(text {:style {:fontSize 15 :paddingTop 10}} title)

martinklepsch09:01:37

Ah, that’s cool, thanks!

misha09:01:16

I think your approach creates 2 nested components

rarous20:01:24

IMO better approach is to use createFactory function:

(def create-factory js/React.createFactory)
(def flip-move (create-factory js/FlipMove))

misha21:01:24


createFactory()
This helper is considered legacy, and we encourage you to either use JSX or use React.createElement() directly instead.