Fork me on GitHub

I am leaning towards making Helix the basis of my new CLJS+RN library based on my own state management library, and I am still wrapping my head around RN itself so this may be wrong, but I think I need to use some form of create-class to be able to force updates when my state management lib sees the need. This doc is great but ends up with class components as "WIP". Is there any progress on that? I will keep staring at RN to see if a supervising engine can force the re-render of functional components -- hints welcome! 🙏


hey kenny! i'll read through the issue you created and your comments on helix-todo-mvc this afternoon.


I will reply re: classes- with hooks, you should not need classes except if you are trying to build an


there's a macro for defining classes called defcomponent in helix.core but I just haven't documented it


the way that you would have your state management lib trigger a render is by using a custom hook in the body of the component listening to the observable that updates the state using some other hook. helix.hooks/use-subscription can cover this use-case in stable react versions today. here's a rough sketch:

(defhook use-observable
     {:get-current-value #(deref rx)
      :subscribe (fn [callback]
                   (let [unsub (subscribe! rx callback)]
                      ;; function to call to unsubscribe when unmounting or `rx` changes

(defnc some-component
  (let [user-name (use-observable user-name-rx)]
    (d/div "Hello, " user-name)))


Awesome. I had my eyes on the error-boundary example, thought I saw the control I needed, but perhaps it would be less brittle to use hooks. I suspect performance will be excellent since they work so hard on that. Thx, @lilactown!