diff --git a/src/reagent/impl/template.cljs b/src/reagent/impl/template.cljs index 7dfa83f..e9fc660 100644 --- a/src/reagent/impl/template.cljs +++ b/src/reagent/impl/template.cljs @@ -323,9 +323,10 @@ (let [props (nth argv 1 nil) hasprops (or (nil? props) (map? props)) jsprops (convert-prop-value (if hasprops props)) + jsprops (if-some [key (key-from-vec argv)] + (oset jsprops "key" key) + jsprops) first-child (+ 1 (if hasprops 1 0))] - (when-some [key (key-from-vec argv)] - (oset jsprops "key" key)) (make-element argv react/Fragment jsprops first-child))) (defn adapt-react-class diff --git a/test/reagenttest/testreagent.cljs b/test/reagenttest/testreagent.cljs index 7c74e19..b870543 100644 --- a/test/reagenttest/testreagent.cljs +++ b/test/reagenttest/testreagent.cljs @@ -1189,8 +1189,12 @@ [:div "hello"] [:div "world"]] ^{:key 2} - [children])])] - (is (= "
hello
world
foo
" + [children] + ^{:key 3} + [:<> + [:div "1"] + [:div "2"]])])] + (is (= "
hello
world
foo
1
2
" (as-string [comp])))))) (defonce my-context (react/createContext "default"))