From f785972ae990ba3f52599b315c6c9b6169ffc922 Mon Sep 17 00:00:00 2001
From: Thomas Heller
Date: Thu, 7 Dec 2017 00:02:04 +0100
Subject: [PATCH] react v16.2 fragment support
---
src/main/shadow/markup/react.cljs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/main/shadow/markup/react.cljs b/src/main/shadow/markup/react.cljs
index eea8454..2a4f8ed 100644
--- a/src/main/shadow/markup/react.cljs
+++ b/src/main/shadow/markup/react.cljs
@@ -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" {})))
@@ -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)
\ No newline at end of file