A React.js wrapper for clojurescript.
Simply add wreak as a dependency in you project.clj :
[ewen/wreak "0.1.0"]
(ns my-namespace
(:require [ewen.wreak :refer [component *component* render]]))
;Create a component
(def my-component
(component "my-component"
{:render (fn [props state statics]
(let [comp *component*] ;*component* is bound to the React component
(.div js/React.DOM nil "Hello")))
:getInitialState (fn [props statics]
{:demo-val "This for demonstration purpose"})
:componentDidMount (fn [props state statics]
;Initialize your component here
)
:componentWillUnmount (fn [props state statics]
;Cleanup actions here
)}))
;Render the component
(let [props {}
statics {}]
(render (my-component props statics)
(.getElementById js/document "root-node")))
Distributed under the Eclipse Public License, the same as Clojure.