-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why not re-frame effect handler? #21
Comments
No real reason, it would be quite trivial to add though |
Although @olimsaidov you can always have a {:dispatch [::re-graph/query ...]} vs {::re-graph/query [...]} Could you explain to me the benefits of the second (or drawbacks of the first)? Thanks |
I am fairly new to clojurescript, but, after reading re-frame docs I learned that all side-effects must be handled via effect handlers. Also there are many third-party libraries for re-frame which use effect handlers for making side-effects: https://github.com/olieidel/awesome-re-frame#effect-handlers |
re-graph does do all its side-effecty things (creating websockets, sending messages) via fx handlers. In fact, a dispatch is an effect itself, just one that happens to be built into re-frame. So, the two snippets I wrote above are functionally equal. If I were to write fx handlers for the re-graph API they would look like this: (re-frame/reg-fx
::query
(fn [& args]
(re-frame/dispatch (into [::query] args)))) So you see the fx handler would just be an extra step to achieve the same thing. With a dispatch it does the same thing, however, you have added flexibility to |
Is there any reason behind why this lib does not integrate itself to re-frame as an effect handler?
The text was updated successfully, but these errors were encountered: