Fork me on GitHub
#reagent
<
2019-04-29
>
ackerleytng14:04:25

is it a convention to use CamelCase for reagent components?

beetleman14:04:25

@ackerleytng components in reagent are normal functions so IMO they should be in kebab-case

rgm18:04:39

I’ve also seen the convention of tacking on -ui for functions intended to be used as reagent components.

rgm18:04:49

That said, I’ve come to personally favour MyComponent … reagent components at the point of use are not really meaningfully the same thing as a clojure function, and for me there’s a pleasing brain thing of how well it maps to the JSX convention of camel casing.

👍 4
rgm18:04:47

(that is, components get used as [MyComponent {:foo "bar"} [:p "etc"]], which if you squint looks like invocation but I think it’s important to have some kind of easy signal that this function produces hiccup).

beetleman20:04:38

ui prefix or suffix is good idea because sooner or later you'll have problem with items vs ui-items where items is list of items from subscription and ui-items is component handling render of items.

[ui-items items]
It recomended way of naming in fulcro and can work well in reagent app too.

👍 4