-
-
Notifications
You must be signed in to change notification settings - Fork 66
Optimization Tips
Andre R edited this page Mar 31, 2016
·
12 revisions
You can explicitly set the attributes to {}
and avoid the ambiguity of children vs attributes that would need to be resolved during runtime. Observe:
(macroexpand-1 '(html [:a (foo)]))
=>
(clojure.core/let
[attrs99902 (foo)]
(clojure.core/apply
js/React.createElement
"a"
(if (clojure.core/map? attrs99902)
(sablono.interpreter/attributes attrs99902)
nil)
(if (clojure.core/map? attrs99902)
nil
[(sablono.interpreter/interpret attrs99902)])))
(macroexpand-1 '(html [:a {} (foo)]))
=> (js/React.createElement "a" nil (sablono.interpreter/interpret (foo)))