devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
tord 2015-10-18T13:40:02.000344Z

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?

tord 2015-10-18T13:42:01.000345Z

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.

tord 2015-10-18T13:59:11.000346Z

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.

bhauman 2015-10-18T15:40:08.000347Z

@tord I have never used reframe so ...

bhauman 2015-10-18T15:40:31.000348Z

@tord: but I would go for it !!

tord 2015-10-18T16:06:08.000349Z

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

bhauman 2015-10-18T16:08:13.000350Z

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

bhauman 2015-10-18T16:08:54.000351Z

I mean the whole react community just uses react

bhauman 2015-10-18T16:09:22.000352Z

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

bhauman 2015-10-18T16:09:45.000353Z

and add a watch to the atom to render on change

bhauman 2015-10-18T16:11:41.000354Z

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

tord 2015-10-18T20:58:00.000355Z

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

tord 2015-10-18T20:58:41.000356Z

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.

bhauman 2015-10-18T23:34:23.000357Z

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