You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(defnc MyComponent[{:keys [variant class-name class]
:or {variant :down class "foo" class-name "bar"}}]
(println "class" (if class class "CLASS NOT TRUTHY"))
(println "classname" (if class-name class-name "CLASSNAME NOT TRUTHY"))
[:div "something"])
When invoking the above code like:
[MyComponent {:variant :up}]
The following is printed:
class CLASS NOT TRUTHY
classname bar
But when invoking it with:
[MyComponent {:class "hx-rocks"}]
class hx-rocks
classname hx-rocks
It seems that :class is set unconditionally to nil in that map, so that the keys destructuring doesn't work. I made this small repro using plain ClojureScript to make sure:
(defn TEST [{:keys [a b] :or {a 1 b 2}}]
(println "A" a "B" b))
(TEST {:a nil})
This prints: A nil B 2.
The text was updated successfully, but these errors were encountered:
When invoking the above code like:
The following is printed:
But when invoking it with:
It seems that :class is set unconditionally to
nil
in that map, so that the keys destructuring doesn't work. I made this small repro using plain ClojureScript to make sure:This prints:
A nil B 2
.The text was updated successfully, but these errors were encountered: