React : Redux = Reagent : re-frame

Chao-Wei Chen
1 min readJun 11, 2021

I try to understand the value proposition of re-frame.

Before so, I found 3 related libraries: React, Redux, and Reagent

React: a JS library to build UI.

Redux: a state container for JS App

React could be sufficient for it own purpose. The reason to do Redux additionally in React is to separate concern. ”By offloading all of the statefulness to a system like Redux, you preserve the purity of React.”

Reagent: a minimalistic interface between ClojureScript and React, describing UI using Hiccup-like syntax.

Now, re-frame, the puzzle. I don’t see clear value proposition in https://day8.github.io/re-frame/, but after all the digging, my gut feeling is

React : Redux = Reagent : re-frame

Specifically, re-frame also wants to centralize state management. Reagent manages state via Reagent.core.atom. Getter is to deref @ the atom. Setter is to swap! or reset! the atom.

Re-frame’s getter is to subscribe (Reagent’s) reactions, and setter is to dispatch events.

Re-frame: a functional framework for writing SPAs in ClojureScript, using Reagent.

As a result, I think the critical question to ask is, why re-frame? will Reagent be sufficient? Alternatively, will you mix Reagent and re-frame?

--

--

Chao-Wei Chen

pythonista, clojurian, semiconductor, mathematics, optics