Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yep. We've been using what is akin to an apollo-client hook at work for the past ~9 months or so:

    (defn my-component []
      (let [user-data (data/pull! :user "{ user { firstName  } }")]
        (fn []
          (if (:loading @user-data)
            [:div "Loading..."]
            [:div "Hello, "
             (get-in @user-data [:data :user firstName]) "!"])))
I'm a bit surprised this pattern isn't more popular; having side-effectful functions return ratoms in a form-2 component seems almost as flexible as Hooks. It seems that most CLJS people try and keep their views more pure, which I think is honestly to their overall detriment. You miss out on the encapsulation and composition that React is espousing.

That being said, I intend to replace reagent soon with just raw React + a few helpers :P



> That being said, I intend to replace reagent soon with just raw React + a few helpers

Do you intend to keep using ClojureScript or use JavaScript/TypeScript? I read pure React with ClojureScript is rather painful (mostly due to the props conversion but maybe that's what your helpers are for?)

I am asking since I am still considering between React (JS/TS) and Reagent/Rum (CLJS) for a side project of mine.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: