4 ms·
It's a method of dealing with the state that is extremely simple. The state is a single immutable object. The bits of your app emit actions, which are just plai
by RobertKerans 11y ago
It's a method of dealing with the state that is extremely simple. The state is a single immutable object. The bits of your app emit actions, which are just plain JS objects. The state is updated by running a reduce function [on the bit of it you want to update] it in response to the action. That's basically it. The 'easy to test bit' isn't an exaggeration; there is no magic at all, and every component part is extremely basic. Behavior becomes very predictable. The source of truth for the app is moved almost entirely to this state object, all other state/side effects are discouraged wherever possible.
The cons (you may/may not see them as such, but..) are
a. for a lot of people it is quite difficult to grok at first,
b. it's extremely functional,
c. it has quite a lot of boilerplate - it is extremely explicit,
d. the app state is held in a single immutable object.