Fork me on GitHub

Could someone give me some pointers to what's happening under the hood? I can't seem to explain why: a) There are renders where the props are identical (per =) b) Wrapping it with a fn and a create-class "solves" it

(defn reagent-component [...]
  (. js/console log "...") ...)

;; 5 reagent-component calls, then 2 with identical props (per =) 
(def ^:export Component-1
  (r/reactify-component reagent-component))

;; Same 5 reagent-component calls, then 2 with identical props (per =)
(def ^:export Component-2
  (r/reactify-component (r/create-class
                         {:reagent-render cards})))

;; 5 reagent-component calls, (expected)
(def ^:export Component-3
  (r/reactify-component (fn []
                           {:reagent-render cards}))))
Is the extra fn somewhow doing the equality check beforehand and not calling the render function? Why would that be different, since there's no other lifecycle method or wrapping render call in place? And should I be worried (and wrap all my components)?


Hello, I'm working on a textarea component generated by reagent. This component appears after a double click and I'm struggling to understand how to put the cursor of this textarea at the end of it. Do you know how I can set the position of the cursor in this texte area please?


I've used (.setSelectionRange textarea-dom-node selection-start selection-end) in component-did-mount


Thank you for the answer, it works for me 🙂 Also, to get the textarea-dom-node as I name my event e I get it with (.-target e) . Do you use something else to ge the textarea-dom-node ?


Well for my case, the user clicks on a div, then the div is replaced with a textarea after the click, so in the :on-click event in the div (.-target e) would be the div not the textarea. So we use (r/dom-node this) in component-did-mount of the textarea component to get the textarea dom node.


but for you, if the click event is on the textarea (.-target e) will work


Thank you very much for the explanation ^^

🙂 4