Fork me on GitHub
#clojurescript
<
2023-07-09
>
Patrick19:07:25

Hey y'all! A bit of a noob design/architecture(?) question on state management. I have a cljs project using UIx2 and Re-frame (Re-fx technically). I'm wondering if anyone has any guidance on when I should use the use-state hook vs "graduate" that state to re-frame? Thanks!

p-himik19:07:34

If you consider some state a part of the whole app's state, then put it inside re-frame's app-db. It's app-db after all. ;)

Sturm22:07:42

Is there a way to interactively see the JS that would be generated for a snippet of CLJS - like http://app.klipse.tech/ but within my REPL?

dpsutton23:07:29

There’s a dynamic variable that prints out function bodies. Try (apropos “bodies”) and it should be in the list

👀 2
dpsutton00:07:15

Did you find it? Does that help you out?

Sturm00:07:02

yes, I (set! *print-fn-bodies* true) and then when evaluating the function symbol I also see the body - that's quite useful

👍 6
jpmonettas12:07:32

You can also do (println (str your-fn)) if you only need to print one, useful if you want to check what a lib or core fn does without re-evaluating it