Fork me on GitHub
#devcards
<
2020-11-21
>
rberger19:11:27

Is it possible to use re-frame with devcards ? There is an old issue still open https://github.com/bhauman/devcards/issues/105 that seems to imply that its not easy to use re-frame with devcards

rberger21:11:34

Sure it is possible or sure it is not possible? Any examples of how it is possible? Thanks!

nenadalm18:11:51

it is possible. > You can then use the `defcard` macro. `defcard` is a multipurpose macro which is designed to take what you are working on elevate live into the browser. It can handle many types of data but primarily takes any type of ReactElement. (http://rigsomelight.com/devcards/#!/devdemos.defcard_api) You can convert hiccup using as-element function in reagent into the ReactElement: https://reagent-project.github.io/docs/master/reagent.core.html#var-as-element Example can be seen here: https://github.com/imatic/re-frame-form/blob/f88f9bf949541f661aae7ffca0f88c4a5a8e0ec2/examples/re-frame-form/src/example/core.cljs#L85 with the ui: https://imatic.github.io/re-frame-form/

rberger18:11:02

Thanks! Will check that out. That issue in devcards just made me assume it was difficult to use re-frame with devcards. I ended up using nubank/workspaces but will go back and try it with devcards now. (actually had some issues with updates happening properly with workspaces that Ihaven’t debugged yet)

nenadalm18:11:57

I don't have the problem with subscriptions. I've never tried workspaces.

rberger18:11:32

Appreciate your help!

rberger00:11:23

Just to confirm, everything is working great for me with re-frame, devcards and shadow-cljs. I guess the issues people were having was more if they wanted separate re-frame app-db for individual devcards. I do not have that requirement. The issue of the cards / reagent components updating reactively in both devcards and workspaces, was my own error of not wrapping the hiccup passed to defcard-ng in a function.

👍 3