r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

View all comments

Show parent comments

3

u/1xltP3mgkiF9 Jun 10 '16

Every time you write an app you have some state. Whether it's explicit or implicit and hidden behind a framework. In case of Redux the "state" is a linear list of sequential one single values. Every action modifies the whole state and produces new state. This makes the unit testing trivial and very simple.

1

u/TheWix Jun 10 '16

Right, but I am wondering can you fuck up the state on one page and cause it to break on another page? This is what I am used to with global state.

1

u/1xltP3mgkiF9 Jun 10 '16

No because when you change page all the client side state is removed - when browser rerenders the page.

1

u/TheWix Jun 10 '16

Are you talking a postback? Cause I am referring to a page in the context of a SPA where there is no postback.

1

u/holloway Jun 11 '16 edited Jun 11 '16

can you fuck up the state on one page and cause it to break on another page?

Redux is about the Previous State (A) which is cloned and modified based on an action to make Current State (B).

So if you fuck up (A) or (B) then it's possible to break another SPA page, especially if that part of the state is only used on that SPA page.

And when an error is made in changing the state (A) or (B) it will probably propagate to subsequent copies of that state... (C) and (D).

If that state is maintained (e.g. in localStorage) across page reloads then it's possible for that breakage to be preserved too.

So Redux isn't a way of removing errors, but it centralises state management, and makes it far easier to audit for state change errors (compared to state being managed in lots of discrete areas without any concurrency management)