This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-10
Channels
- # announcements (16)
- # aws (1)
- # babashka (2)
- # beginners (33)
- # biff (2)
- # clj-kondo (13)
- # cljs-dev (1)
- # cljsrn (3)
- # clojars (6)
- # clojure (198)
- # clojure-australia (3)
- # clojure-europe (41)
- # clojure-france (3)
- # clojure-nl (2)
- # clojure-spec (7)
- # clojure-uk (12)
- # clojurescript (57)
- # clojureverse-ops (1)
- # code-reviews (3)
- # community-development (2)
- # conjure (10)
- # data-science (1)
- # datomic (15)
- # depstar (2)
- # docker (2)
- # etaoin (1)
- # events (1)
- # exercism (5)
- # fulcro (23)
- # helix (23)
- # introduce-yourself (4)
- # jobs (6)
- # kaocha (1)
- # lsp (11)
- # meander (107)
- # off-topic (8)
- # pathom (3)
- # polylith (33)
- # re-frame (23)
- # reagent (7)
- # reitit (28)
- # remote-jobs (3)
- # sci (1)
- # shadow-cljs (2)
- # specter (5)
- # sql (38)
- # tools-deps (72)
- # web-security (9)
- # xtdb (32)
Hey @lilactown, when you have a sec, could explain why I see re-renders due to helix/props
often in the profiler? I'm wondering if I am doing something wrong or this is expected
Also, related to our previous convo around hook tracing/debugging, I have realized that react has improved the hook tracing a bit. Reading up on the GH issues it seems that the first step is what we see now in the debugger where you can a hook index but no name yet...
It's not too useful though since you often end up with many hooks, some of which call other hooks, etc...
(defmacro defrc
[type params & body]
(let [[docstring params body] (if (string? params)
[params (first body) (rest body)]
[nil params body])
; Handle an optional map of options to toggle feature flags
opts? (map? (first body))
opts (if opts?
(first body)
{})
body (if opts?
(rest body)
body)
;; feature flags to enable by default
default-opts {:helix/features
{:fast-refresh true
:define-factory true}}]
`(helix.core/defnc ~type ~@(when docstring [docstring]) ~params
; `merge` to allow consumers to override feature flags in special cases
~(merge default-opts opts)
; Wrap the body in html macro to convert hiccup to react components
(sablono.core/html (do ~@body)))))
the way that factory functions work is:
(foo {:foo "bar})
is equivalent to
(react/createElement foo #js {"helix/props" {:foo "bar"}})
react (and helix) will re-render your component anytime its parent is rendered by default
no, I'm trying to heed the warnings of not over memoing unless needed. Maybe I need to though?