Created
August 24, 2017 13:51
-
-
Save thheller/7f530b34de1c44589f4e0671e1ef7533 to your computer and use it in GitHub Desktop.
Revisions
-
thheller created this gist
Aug 24, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ (defn my-component [props context updater] (cljs.core/this-as this (js/React.Component.call this props context updater) ;; anything else you want to set-up. use goog.object/set on this this)) (gobj/extend (.. my-component -prototype) js/React.Component.prototype) ;; cljs-specific properties on constructor ;; just so (prn my-component) works properly, not actually required (set! (.-cljs$lang$type my-component) true) (set! (.-cljs$lang$ctorStr my-component) "MyComponent") (set! (.-cljs$lang$ctorPrWriter my-component) (fn [this writer opt] (cljs.core/-write writer "MyComponent"))) (set! (.. component-fn -prototype -constructor) my-component)