Liking cljdoc? Tell your friends :D

Tiny App for Repso

Try how tiny it could be with help of macros. Project is experimental, don't use in real-world projects.

Clojars Project

[respo/tiny-app "0.2.3"]

Example

(def store
  ; retusn a Map with data and states: {:states {}}
)
(defn updater [store op op-data]
  ; op is a keyword, op-data is an arbitrary value
  ; retuns a new store
)
(defcomp comp-container [store]
  ; returns virtual DOM like: (div {})
)
(def app
  (create-app-> {:model store
                 :updater updater
                 :view comp-container
                 :mount-target (.querySelector js/document ".app")
                 :show-ops? true})

(set! (.-onload js/window) (:start-app! app))

(def reload! (:reload! app))

More explanations for options:

  • store: pure data
  • updater: pure function
  • view: pure function
  • mount-target: DOM node for mounting app
  • show-ops?: if true, calling dispatch! prints logs

Require code from namespaces:

(ns tiny-app.example
  (:require [respo.macros :refer [defcomp <> div button span]]
            [tiny-app.core :refer [create-app->]]))

Develop

yarn
yarn try
# open localhost:8080

License

MIT

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close