Skip to content

Instantly share code, notes, and snippets.

Created Sep 13, 2018
What would you like to do?
Use same component code for Reagent (client-side) and Hiccup (server-side)
(ns project.common
#?(:cljs (:require [project.util :refer [cc]])))
(defmacro cc [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 []
(cc [child-component {:some :opts}])])
(ns project.util)
(defmacro cc [args]
(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