# ClojureScript

1 min read, 156 words clientclojurescriptbrowser
  • Reactivity comes from The change could come from a deref’ed atom, the arguments passed to the component or component state.

# Shadow-cljs vs Figwheel

Shadow-cljs (the compiler) provides for hot-reloading,

Use react with

  1. reagent
  2. re-frame for SPA

What is ^ carat sign in cljs?

^ is "the meta character" it tells the reader to add the symbol starting with ^ as metadata to the next symbol (provided it is something that implements IMetas)

;; Clojure code
(ns my.namespace)

;; print using JS console
(def my-js-obj #js{:foo "bar"})  ;; var my_js_obj = {foo: 'bar'};
(.log js/console my-js-object)   ;; console.log(my_js_object);
;; => {foo: 'bar'}

;; JS-callable function
(defn ^:export add [a b]         ;; function add(a, b) {
  (+ a b))                       ;;   return a + b;
                                 ;; }

# Resources

Subscribe to our Newsletter

If you like my work and think it was helpful kindly support my work


Buy Me A Coffee