@juhoteperi Congrats on the Reagent release 1.0.0! I notice for React functions you use :f>
to call them.
From a static analysis perspective, it would be nice to support an optional keyword in the first position of a normal component call as well, so e.g. clj-kondo could give you arity or type warnings.
E.g.: [:r> my-component 1 2 3]
(not sure about :r>
, maybe something nicer like [:fn my-component 1 2 3]
could also work)
:r>
is already used, it is for "raw" React components 🙂
[::r/f component 1 2 3]
aliasing reagent.core?
maybe too verbose. but something to think about. if this can be detected uniquely by clj-kondo, it would solve an open issue I've been thinking about for a long time
The issue is here: https://github.com/borkdude/clj-kondo/issues/25
I guess it would be OK to have keyword for the normal Reagent component also. Not sure how safe it would be to detect these keywords. Someone else could also be using them inside Hiccup vectors.
yeah
Best would be if Reagent just had DOM functions like Helix (or Om...)
you mean a function notation instead of vector?
Yeah
then it would work automatically with clj-kondo.
Helix uses macro to generate fns so that probably doesn't work without additional config: https://github.com/lilactown/helix/blob/master/src/helix/dom.cljc
Though Helix components are used thorugh helix.core/$ macro so at they are easy to find... Anyway, I'll open issue on Reagent to keep track of ideas on making the forms easier to analyse.
maybe a simple solution would be to use a macro in reagent.core:
(defmacro f [& args] `[~@args])
so you can write:
(r/f component 1 2 3)
and this would uniquely signal a reagent component being called.