Middleware Flashcards
Explain the middleware process
1) React components call an action creator
2) Action creators are functions that when called return an action object. That object with type and payload properties
3) Objects get forwarded to a series of middleware functions. These functions give us the ability to log modify or even stop actions that have been returned from the action creators. Think of it as a stop station to check to see what the actions are BEFORE they are sent to reducers
4) Action then moves on to the reducers, which produces a new state and is sent to rerendered with new state
Why do we use middleware?
We use middleware to look at actions that are about to be sent to a reducer and we get the opportunity to delay the action, modify it, or even STOP the action entirely.
Only way to get asynch requests to work the way we want in a redux application
How would we create our own middleware?