Fork me on GitHub
#rum
<
2017-02-28
>
mruzekw00:02:15

Has anyone ever received the following error when using advanced compilation and rum:

Uncaught TypeError: Cannot read property ':rum/initial-state' of undefined

mruzekw00:02:42

I’m guessing it’s a lack of externs for a library I recently included, but thought I would ask

mruzekw00:02:52

Curious it’s coming from rum

mruzekw02:02:17

Ah I was inferring externs, all is well now

mruzekw17:02:19

What’s the best way to pass multiple children to a rum component? It’s easy to do one

mruzekw17:02:38

For example:

(rum/defc gallery-panel [children]
  [:div.type.type-one
    children])

mruzekw17:02:11

(gallery-panel image1 image2)

sebastjan.pereyro17:02:59

(gallery-panel [image1 image2])

mruzekw17:02:09

I did, it threw an error

mruzekw17:02:26

Expected a keyword as a tag

sebastjan.pereyro17:02:40

probably you need to convert it to js array

mruzekw17:02:41

This is being used on the backend, so converting to a js array doesn’t make senes

sebastjan.pereyro17:02:41

(test-cmp [[:.first "qwerqwer"] [:.second "12312313"]])

mruzekw17:02:48

For me it’s the following:

(rum/defcs rich-render < (rum/local false)
                         {:did-mount (fn [state]
                                       (reset! (:rum/local state) true)
                                       state)}
  [state comps]
  (let [{[rich & r-args] :rich
         [simplified & s-args] :simplified} comps]
    (if @(:rum/local state)
      (apply rich r-args)
      (apply simplified s-args))))

(defn gallery-image [src]
  (rich-render {:simplified [pending-image src]
                :rich [image-with-load-status src]}))

(rum/defc gallery-panel [children]
  [:div.type.type-one
    children])

(gallery-panel [(gallery-image <src>) (gallery-image <src>)])

mruzekw21:02:36

Is there any issue with putting arbitrary functions on the internal rum state?

sebastjan.pereyro22:02:45

it's okay for react and should be okay for rum