Uhm, I'm trying to use with-redefs
with devcards + Rum/Reagent, and I'm starting to feel like this will not work. With Rum it doesn't really work at all since components are defined using the defc
macro, and with Reagent it only does something when I create the component with (component)
, not [component]
. This is not related to devcards at all, but I was just wondering if someone here has ran into this and managed to go around somehow
What I'd like to do is mock some parts of the app, for example if I have a save button I'd like to create a card where the action always fails, and one where it always succeeds. Or rather, looks like it always fails/succeeds. š
The problem with (component)
is that if you create the reagent component like that, it won't re-render when atoms change
@shaun-mahood: I'm interested in hearing how you use devcards in your everyday workflow? I'm going to talk to js devs about cljs tomorrow and the day after that, and I'm planning on showing them figwheel and devards, among other thing (focusing on workflow). I've never used devcards in a "real project", so it would be nice to hear about your experiences
@kauko: Sure, just writing up a gist and will put the link in here.
Here's the basics of how I use it for actual projects. Once I've done that, it lives on as documentation and tests (and as a replacement for code comments). https://gist.github.com/smahood/f6691fb3675ded24bae293a989898cf4
Iām using reagent 0.6.0-alpha2, which depends on [cljsjs/react-dom "15.0.2-0ā]
However, when running lein deps :tree
, Iām asked to do [reagent "0.6.0-alpha2" :exclusions [cljsjs/react]]
, since devcards depends on [cljsjs/react-dom "0.14.3-0ā]
.
If I do such an exclusion, everything seems to work, but am I then in practice using React Dom0.14?
@shaun-mahood: thanks, appreciate it! I've been giving devcards a try but I've never used it in a "real project", so it's nice to see that it can indeed be more than just a toy
the with-redefs
thing I asked about earlier is a real bummer though, but I guess there's nothing we can do about it
@kauko: I've so far always found ways to refactor my code so that I can use it nicely with devcards - maybe take a look at seeing if you can get the same behaviour without using with-redefs. For reagent specific, take a look at the reagent specific info on https://github.com/Day8/re-frame/wiki if you haven't, I think there should be a way around that in one of the linked pages near the bottom (under "Reagent Tutorials")