Does anyone have any experience using devcards with re-frame? When I try to access re-frame subscriptions from a Reagent component in a devcard, I always get nil -- which I suppose makes sense, since I wouldn't want my devcards to access and mess with the main application state. Would it be possible to write a devcards.core/re-frame
macro, similar to devcards.core/reagent
except that the re-frame variant takes a re-frame app-db instead of a Reagent atom as input?
Devcards are so awesome that I am half tempted to drop re-frame and switch to Om Next just to get everything working, but unfortunately I am too stupid and the Om Next tutorial makes my brain hurt.
Perhaps it's possible to simply change the global re-frame atom to a dynamic var, and then hack up a devcards macro that rebinds this var to a user-supplied atom for the individual devcard? I'll give it a try, unless somebody else already has a working solution.
@tord I have never used reframe so ...
@tord: but I would go for it !!
@bhauman: Thanks, I'll give it a try. I've just realized that my idea above is of course not going to work: By the time the user tries to interact with the component, the dynamic rebinding of the re-frame atom will have expired. I'll have to come up with something better.
@tord if you are just starting out you can just use straight React and sablono. I recomend it highly when you are getting started
I mean the whole react community just uses react
and when you are starting you can use a central data atom
and add a watch to the atom to render on change
it also has the added benefit that your project will not be attached to an "evolving" framework
@bhauman: I am "just starting out" with devcards, but I've built a couple of moderately complex apps with Reagent and re-frame and feel quite comfortable using them. Your advice to do some work with plain React is probably still good, though. There is a little too much magic I don't quite understand in Reagent; a better understanding of plain React would certainly help.
I still hope to find a way to make re-frame work with devcards, though. I'll let you know if I find a solution.
I fixed a bunch of reagent problems today. But I sent out a bad build 0.2.0-7 deploying 0.2.0-8