Home

Awesome

Pump

Note: Pump is deprecated in favor of om.

Pump is ClojureScript bindings for React.

Usage

(ns your.app
  (:require-macros [pump.macros :refer [defr]])
  (:require [pump]))

(defr Component
  :get-initial-state #(identity {:some-value ""})

  [component props state]

  [:div {:class-name "test"} (:some-value @component)])

See defr documentation and an example of usage.

Setting up a project

You will certainly need a react.js file by itself, for example download it from CDNjs, put somewhere locally (i.e. in resources/vendor), and then refer in your :cljsbuild configuration like that:

:cljsbuild
{:builds [{:id "main"
           :source-paths ["cljs"]
           :compiler {:output-to "resources/target/main.js"
                      :foreign-libs [{:file "resources/vendor/react.min.js"
                                      :provides ["React"]}]
                      :optimizations :whitespace}}]}

If you look into cljsbuild internals, you will see that you should be able to use a link instead of downloading file locally. But that didn't work for me.