This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-26
Channels
- # announcements (2)
- # aws (4)
- # babashka (5)
- # beginners (91)
- # calva (4)
- # cider (17)
- # clara (13)
- # clj-kondo (14)
- # cljsrn (11)
- # clojure (159)
- # clojure-europe (2)
- # clojure-nl (14)
- # clojure-norway (2)
- # clojure-taiwan (2)
- # clojure-uk (32)
- # clojurescript (101)
- # clojutre (4)
- # cursive (13)
- # data-science (1)
- # datomic (46)
- # emacs (68)
- # figwheel-main (5)
- # fulcro (48)
- # graalvm (7)
- # graphql (6)
- # instaparse (5)
- # joker (4)
- # lambdaisland (1)
- # leiningen (2)
- # malli (9)
- # off-topic (41)
- # pedestal (15)
- # re-frame (47)
- # reagent (7)
- # reitit (14)
- # shadow-cljs (180)
- # spacemacs (58)
- # specter (1)
- # tools-deps (13)
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 []
(r/create-class
{: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.