Reducing redux meaning
1 min readAug 23, 2020
Redux is a way to optimize and control the way that data flow in an information system, keeping its flow by three simple actors: action, reducer, and store.
Actions: what happened?.
- Payloads of information.
- Source of information.
- Plain objects.
{
type: typeOfAction,
action: contentOfAction
}
Reducers: how the application’s state changes?
- Minimal representation of your app’s state as an object.
function reducerNameA(previousContentOfState, action) { //Some decisions about the action received
switch (action.type) {
case typeOfAction:
return contentOfAction
default:
//if any decision can't resolve the action, return the
//previous content of state.
return previousContentOfState
}
}function reducerNameB(previousContentOfState, action) { switch (action.type) {
case typeOfAction:
return contentOfAction
default:
return previousContentOfState;
}
}reducers = combineReducers(reducerNameA, reducerNameB, ...)
Store: the join between, what happened? and , how the application’s state changes?
- Holds application state.
- Allows access to state.
- Allows state to be updated.
store = createStore(reducers)
Data Flow:
For deeper information review the docs below: