Fork me on GitHub
#reagent
<
2019-06-17
>
Ahmed Hassan08:06:05

What is alternative to using rc-form in this code example? I want to do inter-op with Ant Design Mobile from Reagent. https://mobile.ant.design/components/input-item/#components-input-item-demo-basic.

Ahmed Hassan09:06:54

Code example given above uses createForm High Order Component from rc-form to wrap the form. https://github.com/react-component/form

leontalbot13:06:39

Hi! Can I update this selected-item-atom atom?

(defonce selected-item-atom
  (ratom/make-reaction
   #(get-in @state [:group @selected-group-id-cursor :items @selected-item-id-cursor])))

leontalbot13:06:18

(swap! selected-item-atom assoc :note "foo")

leontalbot13:06:36

I would ideally want a cursor where the path can depend on other cursors, here: @selected-group-id-cursor and @selected-item-id-cursor

leontalbot13:06:48

my selected-item-atom reaction can be read, but apparently I can’t write (update) it

leontalbot14:06:49

(defonce selected-item-atom
  (ratom/make-reaction
   (fn []
     (let [{:keys [selected-group-id selected-item-id] :as s} @state]
       (get-in s [:group selected-group-id :items selected-item-id])))))

leontalbot14:06:51

Interesting, cursor first param can be an atom, but can also be a fn

leontalbot14:06:03

(defn set-get
  ([k] (get-in @state k))
  ([k v] (swap! state assoc-in k v)))

leontalbot14:06:15

we can even ignore path