Skip to content

Instantly share code, notes, and snippets.

Last active September 1, 2016 15:36
What would you like to do?
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/DOM.div nil
(React/DOM.h1 nil "Type some stuff in the text box")
"type" "text"
"value" text
"onChange" handle-change))
(render {:text ""})
;; -- Oh the beautiful DSLs that await us! --
;; (render-component
;; (div nil
;; [(h1 nil "type some stuff here")
;; (input :type "text" :value text :change handle-change)
;; text])
;; js/document.body)
(defproject react-cljs "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url ""
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2080"]
[reactjs "0.5.1"]]
:plugins [[lein-cljsbuild "1.0.0"]]
:source-paths ["src"]
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:compiler {
:output-to "main.js"
:output-dir "out"
:optimizations :none
:source-map true
:foreign-libs [{:file "reactjs/react.js"
:provides ["React"]}]
:externs ["reactjs/externs/react.js"]}}]})
Copy link

przeor commented Sep 1, 2016

Hi I see that you use React, so I am sure that you will find interesting the - this is the free online convention and tutorial book for React.JS Developers. React is not only the View (in MVC) anymore. ReactJS For Dummies: Why & How to Learn React Redux, the Right Way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment