helix

lilactown 2022-06-13T15:09:34.955869Z

you can use helix.hooks/use-state with JS data

lilactown 2022-06-13T15:10:28.432129Z

for error boundaries, you can use helix.core/defcomponent but itโ€™s not super well documented

2022-06-13T19:10:42.402839Z

I'll try that, if it makes better error catching.

lilactown 2022-06-13T19:49:39.900969Z

here's a "simple" example:

(defcomponent error-boundary
  (constructor
    [this]
    (set! (.-state this) #js {:error nil}))

  ^:static
  (getDerivedStateFromError
    [this error]
    #js {:error error})

  (render
    [this props state]
    (if-let [error (.-error ^js state)]
      (if (:on-error-component props)
        ($ (:on-error-component props))
        (d/div (pr-str error)))
      (:children props))))

๐Ÿ‘ 1