This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-13
Channels
- # beginners (28)
- # boot (3)
- # clara (9)
- # cljs-dev (127)
- # clojure (82)
- # clojure-belgium (3)
- # clojure-italy (7)
- # clojure-russia (2)
- # clojure-spec (4)
- # clojure-uk (2)
- # clojurescript (351)
- # data-science (3)
- # datascript (1)
- # datomic (24)
- # fulcro (15)
- # jobs (3)
- # juxt (16)
- # off-topic (2)
- # onyx (18)
- # parinfer (1)
- # pedestal (3)
- # perun (6)
- # re-frame (14)
- # spacemacs (20)
@akiroz having to declare actions as const is more a failing of Javascript in general, than Redux in particular. Clojure’s rich data literals — keywords in this case — I think let us avoid stuff like that in many cases.
Hi, I managed to use an input field without using a ratom but used this as attributes: :value @(rf/subscribe [:id])
and :on-change #(rf/dispatch [:event-id (-> % .-target .-value)])
. What would be the benefits of using a ratom? Robustness facing conccurency? Thanks.
@profgra If you want to dispatch value of the input for each change, then there is no need to use ratom. If you wanted to dispatch the value on latest change (e.g. by clicking some button) - then you would have to store the value somewhere in the component (in ratom) before dispatching it.
@profgra you might check react forms documentation for more details for the ratom case on what I've tried to describe: https://facebook.github.io/react/docs/forms.html
@nenadalm but how can we know the value of the input from the button? I thought that every value had to be in app-db?
@profgra you can use on-change
event to update the ratom and then when you click the button, you dispatch value of the ratom.
This part is fuzzy to me: «when you click the button, you dispatch value of the ratom».
@profgra you can dispatch value of the ratom with button like this: https://github.com/nenadalm/Warehouse/blob/4e9803598041bb55d0ebfc119dd4f1aa4e672eca/frontend/src/warehouse/views.cljs#L66
@profgra in inputs, you update the ratom instead of dispatching the value: https://github.com/nenadalm/Warehouse/blob/4e9803598041bb55d0ebfc119dd4f1aa4e672eca/frontend/src/warehouse/views.cljs#L21
@scknkkrer try asking in #cljsrn