gadfly361 / soda-ash

Soda-ash is an interface between clojurescript's Reagent and Semantic UI React
MIT License
152 stars 8 forks source link

How to pass a child component as a prop? #8

Closed stoeckley closed 6 years ago

stoeckley commented 6 years ago

How to pass a Semantic component as an "element" in props, like here:

https://react.semantic-ui.com/elements/input#input-example-icon-element

I tried:

[sa/Input {:icon [sa/Icon {:name "cancel" ...}] ... }]

This nesting behavior and ability to pass components as props will probably come up occasionally but I cannot figure out the corresponding cljs syntax for it.

gadfly361 commented 6 years ago

@astoeckley You are looding for reagent/as-element

[sa/Input {:icon (reagent/as-element [sa/Icon {:name "cancel"}])}]
stoeckley commented 6 years ago

thankx!