Created
April 21, 2020 12:04
-
-
Save darkleaf/cb75364cd6d6f84223e51116520c1ffc to your computer and use it in GitHub Desktop.
react interop example
This file contains 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 characters
(ns example.core | |
(:require | |
[hicada.compiler :as h])) | |
(defmacro html [body] | |
(h/compile body {} {} &env)) |
This file contains 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 characters
(ns example.core | |
(:require | |
[goog.dom :as dom] | |
[react :as react] | |
[react-dom :as react-dom] | |
[applied-science.js-interop :as j]) | |
(:require-macros | |
[example.core :refer [html]])) | |
(j/defn component [^:js {:keys [name children]}] | |
(html | |
[:div | |
[:div name] | |
[:div children]])) | |
(react-dom/render | |
(html | |
[:* | |
[:div "foo 5"] | |
[:> component {:name "John II3"} | |
[:div "inner 1"] | |
[:div "inner 2"]]]) | |
(dom/getElement "app")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment