5

Is it possible to use third-party React components in an Om application?

I have a project written in ClojureScript with Om and I would like to use JedWatson/react-select, how should I approach this problem?

Victor Marchuk
  • 13,045
  • 12
  • 43
  • 67

1 Answers1

8

There are a few steps to this:

  • Packaging the JS library for use in Clojurescript JS libaries are packages as foreign-libraries you can read more about this in the ClojureScript wiki.
  • after you required your foreign lib you can access it though the global namespace (js/) and call functions defined by your library.

Here is an example of using fixed-data-table with Om.

The packaged foreign library for it can be found in the CLJSJS packages repository. (More information about CLJSJS can be found on the website: http://cljsjs.github.io/)

Martin Klepsch
  • 1,875
  • 3
  • 18
  • 24
  • Thanks. Is there a way to bundle in library's CSS in a similar fashion? – Victor Marchuk Aug 21 '15 at 14:15
  • Could you please explain the packaging process in a bit more details. Do I need to create an uberjar via `lein uberjar` or it's not necessary? Also, what is supposed to go in `externs.js`? It's not quite clear from the wiki – Victor Marchuk Aug 21 '15 at 17:38
  • In addition: This is pretty cool: http://mneise.github.io/posts/2015-08-04-week-9-and-10.html – ClojureMostly Aug 21 '15 at 23:12
  • There is a wiki page on using [non JS assets](https://github.com/cljsjs/packages/wiki/Non-JS-Assets) in the CLJSJS wiki but it presumes [boot](http://boot-clj.com/) and is in general a bit more manual. – Martin Klepsch Aug 22 '15 at 10:21