Fork me on GitHub
#helix
<
2022-08-17
>
Evan Z23:08:57

Hey all, I’m running into “Maximum call stack size exceeded” with the demo. This happens when typing in the text field. For completeness:

(ns machine-monitor.core 
  (:require [helix.core :refer [defnc $]]
            [helix.hooks :as hooks]
            [helix.dom :as d]
            ["react-dom" :as rdom]))

;; define components using the `defnc` macro
(defnc greeting
  "A component which greets a user."
  [{:keys [name]}]
  ;; use helix.dom to create DOM elements
  (d/div "Hello, " (d/strong name) "!"))

(defnc app []
  (let [[state set-state] (hooks/use-state {:name "Helix User"})]
    (d/div
     (d/h1 "Welcome!")
      ;; create elements out of components
      ($ greeting {:name (:name state)})
      (d/input {:value (:name state)
                :on-change #(set-state assoc :name (.. % -target -value))}))))

;; start your app with your favorite React renderer
(rdom/render ($ app) (js/document.getElementById "app"))

Evan Z00:08:24

Reverted to 0.1.6 and it works. Looks like a regression?

lilactown02:08:37

yeah, there's an open PR for it. will merge it and release a new version