Fork me on GitHub
#rum
<
2017-03-01
>
Niki07:03:08

just use list, vectors have a special meaning in Rum components

Niki07:03:18

it tries to interpret them as a tag

Niki07:03:37

> Is there any issue with putting arbitrary functions on the internal rum state? No, put whatever you want

kurt-o-sys13:03:04

I have to wrap my head around rum a little... so, if I want to add an existing react component (https://github.com/FineUploader/react-fine-uploader)... how to make that happen properly in rum?

kurt-o-sys13:03:31

or would it be better to use the base js implementation?

kurt-o-sys14:03:02

ok... so, 1. I install the 3rd party react component with npm - it ends up in ~/node_modules. 2. I define:

(defn upload-el []
  (js/React.createElement js/Gallery
                          #js {}))
3. ...? If I run after step 2, I get:
Uncaught ReferenceError: Gallery is not defined
    at [...]$upload_el (upload.cljs:4)
    at [...] (app.cljs:17)
    at init1447.cljs:2
    at Object.G__10460__delegate (reload.cljs:53)
    at Object.G__10460 (reload.cljs:53)
    at goog.async.Deferred.fire_ (deferred.js:649)
    at goog.async.Deferred.updateResult_ (deferred.js:298)
    at goog.async.Deferred.continue_ (deferred.js:282)
    at goog.async.Deferred.fire_ (deferred.js:649)
[...]
rum looks for that react element (and not react), and obviously, can't find it...

kurt-o-sys14:03:07

... or how can I make rum find the react component (I'm using boot as build tool, it it matters 🙂 )

martinklepsch14:03:50

@kurt-o-sys installing packages straight from npm is still very much an experimental thing. In the immediate term you’re most likely better of checking cljsjs and publishing a package there

mruzekw14:03:31

You could also fork the project, set it up to build to UMD, copy and paste the UMD file into your resources, then put a reference to it in :foreign-libs

mruzekw14:03:44

Been through this process a couple of times now.

mruzekw14:03:12

The only other issue is externs. So you could :infer-externs, see if that covers your cases. Or you can manually write them.

mruzekw14:03:31

(Hopefully the library isn’t too large)

kurt-o-sys15:03:47

ok... let's see: to use a react component, I can: 1. try to make a cljsjs package (never done it before) 2. fork, build to UMD, copy-paste, put in :foreign-libs I guess I'll try the first one; both need finding the interns etc, so well, I have to give it a shot, I guess. See how hard it is 😛.

mruzekw15:03:56

Hopefully we’ll get to use node_modules very soon

mruzekw15:03:02

That would be glorious

kurt-o-sys15:03:41

yeah... would be much nicer for react components.

mruzekw15:03:57

There’s also https://clojurescript.org/guides/javascript-modules Look at the last section if you haven’t already

mruzekw15:03:15

The main issue is including all the dependencies of the module

kurt-o-sys15:03:17

oh, that may make sense... let me try this 😛

mruzekw15:03:11

🙂