Re:Clojure: Realtime collaborative web apps without ClojureS...
by enugu on Friday April 11, 2025 @12:34AM
(#43650543)
Doesn't re-frame also work with ui as a pure function of state? (https://day8.github.io/re-frame/a-loop/)
So, is the main difference that replicant is not built on top of react?
Re:Clojure: Realtime collaborative web apps without ClojureS...
by diggan on Friday April 11, 2025 @06:54AM
(#43652486)
reagent (which you'd put re-frame on top of) is what handles rendering (via React) when we're using re-frame, and is the library you can say does "UI as a pure function of state". re-frame is basically like redux (over-simplification) but for the CLJS ecosystem, focuses solely on state and how to mutate it.
Replicant takes this idea and runs with it, narrowing it down even further: The function is a pure function that returns the new UI as data. Replicant uses this representation to update the DOM accordingly.
That’s it. No partial updates, no mutable objects, no network activity from UI components. It’s basically a templating system. You give it data, and it returns a view. Whether that data comes from a DB or any other place, it's just a clojure data structure. Here is the article that most of this comment is lifted from: https://replicant.fun/top-down/