Add special cases for runtime map to props conversion

This commit is contained in:
Andrey Antukh 2024-01-11 15:23:58 +01:00
parent 9149772ce9
commit 4d54768875

View file

@ -86,10 +86,16 @@
obj))) obj)))
(defn- props-key-fn (defn- props-key-fn
[key] [k]
(if (or (= key :class) (= key :class-name)) (if (or (keyword? k) (symbol? k))
"className" (let [nword (name k)]
(str/camel (name key)))) (cond
(= nword "class") "className"
(str/starts-with? nword "--") nword
(str/starts-with? nword "data-") nword
(str/starts-with? nword "aria-") nword
:else (str/camel nword)))
k))
(defn clj->props (defn clj->props
[props] [props]