Created
September 13, 2018 19:26
Star
You must be signed in to star a gist
Use same component code for Reagent (client-side) and Hiccup (server-side)
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 project.common | |
#?(:cljs (:require [project.util :refer [cc]]))) | |
#?(:clj | |
(defmacro cc [args] | |
`(~@args))) | |
(defn child-component [& opts] | |
[:div "hello"]) | |
;; is there a way to bypass calling (cc ...) when using | |
;; [child-component], but still be able to use this function both in | |
;; cljs and clj ? | |
(defn parent-component [] | |
[:div | |
(cc [child-component {:some :opts}])]) |
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 project.util) | |
(defmacro cc [args] | |
`~args) |
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 project.util | |
(:require-macros [project.util])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment