Skip to content

EwenG/wreak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wreak

A React.js wrapper for clojurescript.

Usage

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")))

Documentation

Wreak documentation

Licence

Distributed under the Eclipse Public License, the same as Clojure.

About

React.js wrapper for clojurescript

Resources

Stars

Watchers

Forks

Packages

No packages published