helix

2022-08-18T02:34:44.236449Z

@lilactown as long as I have you, I’m quite new to clojurescript development and am curious if I should expect that reloading toplevel definitions in the REPL should change content on the page dynamically

lilactown 2022-08-18T02:35:16.875689Z

you have to set that up. are you using the fast refresh feature of helix?

2022-08-18T02:36:28.320019Z

I’m trying to but not sure how to verify. I’m a bit confused by how that works. Does that retain state across refreshes or across redefinitions?

2022-08-18T02:38:43.203989Z

oh I missed this lib.cljc guy that seems to do some redefinition of defnc

2022-08-18T02:38:54.322959Z

I was wondering how this component flag gets injected.

lilactown 2022-08-18T02:44:39.813499Z

yeah, it's kind of awkward rn. you have to define your own defnc macro

lilactown 2022-08-18T02:45:40.401459Z

react-refresh ought to refresh all of the components in the namespace you change, and retain any state unless you've changed the hooks used inside it

lilactown 2022-08-18T02:49:05.265179Z

if you don't care for it, you can always do this:

(ns my-app.core
  (:require
   ["react-dom" :as rdom]
   [helix.core :refer [$ defnc])

(defnc my-app
  []
  "hello")

(def root (rdom/createRoot (js/document.getElementById "app"))

(defn ^:dev/after-load start!
  []
  (.render root ($ my-app))

lilactown 2022-08-18T02:49:51.437979Z

react 18 syntax above. if you're using react 17 or earlier, you can just call rdom/render in start!

lilactown 2022-08-18T02:50:29.739529Z

just released helix 0.1.8 with the fix for that infinite loop