Closed orestis closed 5 years ago
Sure! Seems like it would be more readable that way.
We should probably use gobj/set
rather than set!
to avoid errors under advanced compilation.
It might increase the bundle size slightly (since the displayName won't get minified), but seems fine.
Ok, propTypes is also trivial to add. Not sure if there should be an explicit dependency on it, but my guess is that most React libraries will use it anyway, so it will be present in the bundled code anyway.
It's not 100% required, since you can provide a function to do any kind of validating needed, but it does have some nice comforts.
Fixed the displayName in latest master. Feel free to open another issue for the propTypes thing.
I was using the react dev tools in Chrome and noticed that components used the munged clojurescript function name, which is not that pretty.
Turns out you can set a displayName attribute and React will use that instead. Since
defnc
is a macro, we have access to the original name and namespace, so therefore you can do:I'm not 100% sure yet if this will work nicely with release builds, but I'm opening an issue to see if you would be willing to accept this. If yes, I'll investigate properly and make a PR. I also wanted to look into propTypes since they use the same mechanism.