Fork me on GitHub
#devcards
<
2015-10-18
>
tord13:10:02

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?

tord13:10:01

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.

tord13:10:11

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.

bhauman15:10:08

@tord I have never used reframe so ...

bhauman15:10:31

@tord: but I would go for it !!

tord16:10:08

@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.

bhauman16:10:13

@tord if you are just starting out you can just use straight React and sablono. I recomend it highly when you are getting started

bhauman16:10:54

I mean the whole react community just uses react

bhauman16:10:22

and when you are starting you can use a central data atom

bhauman16:10:45

and add a watch to the atom to render on change

bhauman16:10:41

it also has the added benefit that your project will not be attached to an "evolving" framework

tord20:10:00

@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.

tord20:10:41

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.

bhauman23:10:23

I fixed a bunch of reagent problems today. But I sent out a bad build 0.2.0-7 deploying 0.2.0-8