top | item 23640567

(no title)

oweqruiowe | 5 years ago

I use Clojurescript professionally and it has the best state management story with re-frame over JS and any transpile-to-js language. It's so lovely.

discuss

order

oweqruiowe|5 years ago

To expand, I love this document even from the standpoint of how to structure client-side code http://day8.github.io/re-frame/application-state

It applies to React/Redux folks as well.

> There are benefits to having data in the one place:

> Here's the big one: because there is a single source of truth, we write no code to synchronise state between many different stateful components. I cannot stress enough how significant this is. You end up writing less code and an entire class of bugs is eliminated. (This mindset is very different to OO which involves distributing state across objects, and then ensuring that state is synchronised, all the while trying to hide it, which is, when you think about it, quite crazy ... and I did it for years).

> Because all app state is coalesced into one atom, it can be updated with a single reset!, which acts like a transactional commit. There is an instant in which the app goes from one state to the next, never a series of incremental steps which can leave the app in a temporarily inconsistent, intermediate state. Again, this simplicity causes a certain class of bugs or design problems to evaporate.