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
Sometimes you get a JS object and want to forward it as props to a component.
What we'd like to do:
(defncmy-component []
;; `some-lib/Foo` is an external lib that uses a common pattern:;; pass it a function-as-children which it then passes props to as a JS object
($ some-lib/Foo
(fn [foo-props]
(d/div {& foo-props} "I'm so foo-y!"))))
Currently, this requires converting or wrapping foo-props so that it is a CLJS map-alike, so that spread props works.
(defncmy-component []
($ some-lib/Foo
(fn [foo-props]
;; wrap it in a bean, so that it can then be converted into a JS obj again... :sad:
(d/div {& (cljs-bean.core/bean foo-props)} "I'm so foo-y!"))))
To support writing spread props like in the first snippet, spread props should check to see if it's a map-alike and if not, fall back to merging it in by Object.keys.
The text was updated successfully, but these errors were encountered:
Sometimes you get a JS object and want to forward it as props to a component.
What we'd like to do:
Currently, this requires converting or wrapping
foo-props
so that it is a CLJS map-alike, so that spread props works.To support writing spread props like in the first snippet, spread props should check to see if it's a map-alike and if not, fall back to merging it in by
Object.keys
.The text was updated successfully, but these errors were encountered: