day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
796 stars 147 forks source link

Allow :ref as a component attribute #185

Closed kaosko closed 3 years ago

kaosko commented 5 years ago

Current reagent allows :ref attribute for referring to the component itself at render time. For re-com components, using :attr {:ref #my-function} works but it's flagged as a warning: "Validation failed for argument ':attr' in component ...". Would certainly be easy to add :ref to the attribute validation, but perhaps :ref should be supported as a first-class attribute across any re-com component?

Frozenlock commented 5 years ago

I have dozens of warnings because of this. I think it should remain inside :attr.

Frozenlock commented 4 years ago

For the validation, I propose to add a section react with those 2 keys:

( https://github.com/day8/re-com/blob/master/src/re_com/validate.cljs#L181)