Skip to content

Commit

Permalink
react v16.2 fragment support
Browse files Browse the repository at this point in the history
  • Loading branch information
thheller committed Dec 6, 2017
1 parent 623680b commit f785972
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/shadow/markup/react.cljs
Expand Up @@ -4,7 +4,8 @@
(:require-macros [shadow.markup.react :as m])
;; macro requires this
(:require [shadow.markup.react.impl.interop :as interop]
[shadow.markup.css :as css]))
[shadow.markup.css :as css]
["react" :as react]))

(defn for [& args]
(throw (ex-info "shadow.markup.react/for is a macro" {})))
Expand All @@ -17,4 +18,10 @@
(js/goog.object.set props "dangerouslySetInnerHTML" html))
props)

(defn fragment [& body]
(let [arr (into-array body)]
(.unshift arr nil)
(.unshift arr react/Fragment)
(.apply react/createElement nil arr)))

(m/define-elements)

0 comments on commit f785972

Please sign in to comment.