4 ms·
For server calls, we just use the event dispatch system that comes with re-frame. For most such server calls, one needs to do 3 things: 1) Based on the current
by i_s 7y ago
For server calls, we just use the event dispatch system that comes with re-frame. For most such server calls, one needs to do 3 things:
1) Based on the current app-state, make a request
2) Update the app-state with a marker that this request is pending
3) When the response comes back, update the app-state with the response
Re-frame doesn't ship with a handler that does all those 3 things, but it is pretty trivial to make your own, and that covers almost all use cases that we have. In some cases, when the request is just fetching data that is read-only, we do it via a subscription that is dereferenced in the view. The subscription can be made to handle everything, so it is even easier.
> Also, are you using core.spec or transducers regularly?
No we haven't seen a big need for either. For transducers, the idea is cool, but it hasn't changed how most people in Clojure write their code day to day. In most cases, normal (->> xs (map ..) (filter ..)) type approaches have acceptable performance, so bothering with something that will just make it harder to understand/modify does not seem worth it.
For spec, some of the concepts are good (like orienting around namespaced keywords, but we haven't been able to use it, since it isn't data-driven, and our app is very dynamic. In that sense, JSON Schema is better (which we do use in some places). We plan to give spec another look once they release the second version, which is meant to fix that.
For react-hooks, I haven't seen too much interest from the ClojureScript community. It just doesn't solve a real problem we have - we've already made good abstractions to work around the common problems people have with React.