add :> syntax for interop with React

This commit is contained in:
roman01la
2021-03-05 17:49:48 +02:00
parent 4119e51fc2
commit e93c85444e

View File

@ -276,6 +276,10 @@
"Returns the compilation strategy to use for a given element."
[[tag attrs & content :as element] env]
(cond
;; e.g. [:> ...]
(= tag :>)
::react-interop
;; e.g. [:span "foo"]
(every? literal? element)
::all-literal
@ -316,6 +320,10 @@
{:private true}
element-compile-strategy)
(defmethod compile-element ::react-interop
[element env]
`(rum.core/adapt-class ~@(rest element)))
(defmethod compile-element ::all-literal
[element env]
(compile-react-element (eval element) env))