helix 2022-06-13

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

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

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

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