"reducers in action" Антон Молдован
TRANSCRIPT
Reducers in Action
Anton Moldovan EY
@antyadev
About me:
@AntyaDev like types*
Is an architectural pattern proposed by Greg Young that segregates reads and writes of system into two separate subsystems.
Capture intent Easy to Scale
append only
Reducer<I,E> :: (I, E) -> I
A pure function that takes an initial value and an element, and returns a new value for the initial item
const counter = (state, action) => { switch (action.type) { case 'INCREMENT': return state + 1; case 'DECREMENT': return state – 1; default: return state; } }
(state, action) => state
Mutate its arguments
Perform side effects like API calls
Calling non-pure functions like Date.now() or Math.random()
Th
e P
ro
blem
Greg Young • Event Sourcing https://www.youtube.com/watch?v=8JKjvY4etTY GregYoung 8 CQRS Class https://www.youtube.com/watch?v=whCk1Q87_ZI Timelines at Scale http://www.infoq.com/presentations/Twitter-Timeline-Scalability Redux http://redux.js.org/index.html
@antyadev