You send a simple object:
{ type: 'BLA_BLA' }
This is your action.
It
function qq() { return { type: 'BLA_BLA', } }
your "Creator of the action" (action creator).
The object type (and data if needed), hit reducer, it is necessary to shoot through a dedicated "pipe" - the dispatch (dispatcher).
That is:
dispatch(qq()) // or dispatch({ type: 'BLA_BLA', })
Then, passed through the "Manager" object that will go into all reduceri. In some reduceron, will the command "FAS" for a certain type (type), in our case the string 'BLA_BLA', then:
export default (state = initialState, action) => { switch (action.type) { case 'BLA_BLA': // here comes the javascript compiler, so you've got the right case // for the above indicated switch according to the type of action (action.type) // below you do what you need with your data // specifically, in this case, you take everything you had to state, and change the loading to true return { ...state, loading: true }; case CALLBACK_SUCCESS: // here the action of type 'BLA_BLA' does not hit return { ...state, status: 'OK' }; case CALLBACK_ERROR: // here too return { ...state, status: 'ERROR', message: action.message }; default: // and here return state; } }