I've been using Redux for several months and have a good feel for the unidirectional data flow. However, I'm not trained in OOP and Design Patterns. After listening to a talk by Ralph E Johnson my first reaction was that the Observable Pattern is very similar to Redux/Flux flow, is that correct? Where does that analogy break down?
He talks about the Interfaces required to implement Observable Patterns - is this the sort of thinking that the authors of Redux/Flux architecture have in mind when designing these libraries/architectures?
At its core, Redux is really a fairly simple design pattern: all your "write" logic goes into a single function, and the only way to run that logic is to give Redux a plain object that describes something that has happened.
Redux is a pattern and library for managing and updating application state, using events called "actions". It serves as a centralized store for state that needs to be used across your entire application, with rules ensuring that the state can only be updated in a predictable fashion.
Redux is a library that acts as a state container and helps managing your application data flow. It was introduced back in 2015 at ReactEurope conference (video) by Dan Abramov. It is similar to Flux architecture and has a lot in common with it.
In this brief introduction to Redux, we'll go over the main concepts: reducers , actions , action creators and store .
Yes, the Redux store itself is a simple observable/pub-sub implementation, with a single "change/updated" event emitter. The use of actions and reducers has some similarities to CQRS and event sourcing as well. See https://redux.js.org/introduction/motivation and https://redux.js.org/introduction/prior-art .
In Redux the State Tree uses the Singleton pattern and the connect method uses the Observer pattern.
Taken from An Obsession with Design Patterns: Redux by Andra Joy Lally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With