Skip to content

piranha/pump

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

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.